|
| 1 | +// Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | +// Licensed under the MIT License. |
| 3 | +// Code generated by Microsoft (R) TypeSpec Code Generator. |
| 4 | + |
| 5 | +package azure.clientgenerator.core.hierarchybuilding; |
| 6 | + |
| 7 | +import azure.clientgenerator.core.hierarchybuilding.implementation.HierarchyBuildingClientImpl; |
| 8 | +import azure.clientgenerator.core.hierarchybuilding.models.Animal; |
| 9 | +import com.azure.core.annotation.Generated; |
| 10 | +import com.azure.core.annotation.ReturnType; |
| 11 | +import com.azure.core.annotation.ServiceClient; |
| 12 | +import com.azure.core.annotation.ServiceMethod; |
| 13 | +import com.azure.core.exception.ClientAuthenticationException; |
| 14 | +import com.azure.core.exception.HttpResponseException; |
| 15 | +import com.azure.core.exception.ResourceModifiedException; |
| 16 | +import com.azure.core.exception.ResourceNotFoundException; |
| 17 | +import com.azure.core.http.rest.RequestOptions; |
| 18 | +import com.azure.core.http.rest.Response; |
| 19 | +import com.azure.core.util.BinaryData; |
| 20 | +import com.azure.core.util.FluxUtil; |
| 21 | +import reactor.core.publisher.Mono; |
| 22 | + |
| 23 | +/** |
| 24 | + * Initializes a new instance of the asynchronous HierarchyBuildingClient type. |
| 25 | + */ |
| 26 | +@ServiceClient(builder = HierarchyBuildingClientBuilder.class, isAsync = true) |
| 27 | +public final class HierarchyBuildingAsyncClient { |
| 28 | + @Generated |
| 29 | + private final HierarchyBuildingClientImpl serviceClient; |
| 30 | + |
| 31 | + /** |
| 32 | + * Initializes an instance of HierarchyBuildingAsyncClient class. |
| 33 | + * |
| 34 | + * @param serviceClient the service client implementation. |
| 35 | + */ |
| 36 | + @Generated |
| 37 | + HierarchyBuildingAsyncClient(HierarchyBuildingClientImpl serviceClient) { |
| 38 | + this.serviceClient = serviceClient; |
| 39 | + } |
| 40 | + |
| 41 | + /** |
| 42 | + * Update a pet. |
| 43 | + * <p><strong>Request Body Schema</strong></p> |
| 44 | + * |
| 45 | + * <pre> |
| 46 | + * {@code |
| 47 | + * { |
| 48 | + * kind: String (Required) |
| 49 | + * name: String (Required) |
| 50 | + * } |
| 51 | + * } |
| 52 | + * </pre> |
| 53 | + * |
| 54 | + * <p><strong>Response Body Schema</strong></p> |
| 55 | + * |
| 56 | + * <pre> |
| 57 | + * {@code |
| 58 | + * { |
| 59 | + * kind: String (Required) |
| 60 | + * name: String (Required) |
| 61 | + * } |
| 62 | + * } |
| 63 | + * </pre> |
| 64 | + * |
| 65 | + * @param animal The animal parameter. |
| 66 | + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. |
| 67 | + * @throws HttpResponseException thrown if the request is rejected by server. |
| 68 | + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. |
| 69 | + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. |
| 70 | + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. |
| 71 | + * @return the response body along with {@link Response} on successful completion of {@link Mono}. |
| 72 | + */ |
| 73 | + @Generated |
| 74 | + @ServiceMethod(returns = ReturnType.SINGLE) |
| 75 | + public Mono<Response<BinaryData>> updatePetWithResponse(BinaryData animal, RequestOptions requestOptions) { |
| 76 | + return this.serviceClient.updatePetWithResponseAsync(animal, requestOptions); |
| 77 | + } |
| 78 | + |
| 79 | + /** |
| 80 | + * Update a dog. |
| 81 | + * <p><strong>Request Body Schema</strong></p> |
| 82 | + * |
| 83 | + * <pre> |
| 84 | + * {@code |
| 85 | + * { |
| 86 | + * kind: String (Required) |
| 87 | + * name: String (Required) |
| 88 | + * } |
| 89 | + * } |
| 90 | + * </pre> |
| 91 | + * |
| 92 | + * <p><strong>Response Body Schema</strong></p> |
| 93 | + * |
| 94 | + * <pre> |
| 95 | + * {@code |
| 96 | + * { |
| 97 | + * kind: String (Required) |
| 98 | + * name: String (Required) |
| 99 | + * } |
| 100 | + * } |
| 101 | + * </pre> |
| 102 | + * |
| 103 | + * @param animal The animal parameter. |
| 104 | + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. |
| 105 | + * @throws HttpResponseException thrown if the request is rejected by server. |
| 106 | + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. |
| 107 | + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. |
| 108 | + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. |
| 109 | + * @return the response body along with {@link Response} on successful completion of {@link Mono}. |
| 110 | + */ |
| 111 | + @Generated |
| 112 | + @ServiceMethod(returns = ReturnType.SINGLE) |
| 113 | + public Mono<Response<BinaryData>> updateDogWithResponse(BinaryData animal, RequestOptions requestOptions) { |
| 114 | + return this.serviceClient.updateDogWithResponseAsync(animal, requestOptions); |
| 115 | + } |
| 116 | + |
| 117 | + /** |
| 118 | + * Update a pet. |
| 119 | + * |
| 120 | + * @param animal The animal parameter. |
| 121 | + * @throws IllegalArgumentException thrown if parameters fail the validation. |
| 122 | + * @throws HttpResponseException thrown if the request is rejected by server. |
| 123 | + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. |
| 124 | + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. |
| 125 | + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. |
| 126 | + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. |
| 127 | + * @return the response body on successful completion of {@link Mono}. |
| 128 | + */ |
| 129 | + @Generated |
| 130 | + @ServiceMethod(returns = ReturnType.SINGLE) |
| 131 | + public Mono<Animal> updatePet(Animal animal) { |
| 132 | + // Generated convenience method for updatePetWithResponse |
| 133 | + RequestOptions requestOptions = new RequestOptions(); |
| 134 | + return updatePetWithResponse(BinaryData.fromObject(animal), requestOptions).flatMap(FluxUtil::toMono) |
| 135 | + .map(protocolMethodData -> protocolMethodData.toObject(Animal.class)); |
| 136 | + } |
| 137 | + |
| 138 | + /** |
| 139 | + * Update a dog. |
| 140 | + * |
| 141 | + * @param animal The animal parameter. |
| 142 | + * @throws IllegalArgumentException thrown if parameters fail the validation. |
| 143 | + * @throws HttpResponseException thrown if the request is rejected by server. |
| 144 | + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. |
| 145 | + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. |
| 146 | + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. |
| 147 | + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. |
| 148 | + * @return the response body on successful completion of {@link Mono}. |
| 149 | + */ |
| 150 | + @Generated |
| 151 | + @ServiceMethod(returns = ReturnType.SINGLE) |
| 152 | + public Mono<Animal> updateDog(Animal animal) { |
| 153 | + // Generated convenience method for updateDogWithResponse |
| 154 | + RequestOptions requestOptions = new RequestOptions(); |
| 155 | + return updateDogWithResponse(BinaryData.fromObject(animal), requestOptions).flatMap(FluxUtil::toMono) |
| 156 | + .map(protocolMethodData -> protocolMethodData.toObject(Animal.class)); |
| 157 | + } |
| 158 | +} |
0 commit comments