|
| 1 | +/* |
| 2 | + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. |
| 3 | + */ |
| 4 | + |
| 5 | +package com.sap.cloud.sdk.services.inlineobject.api; |
| 6 | + |
| 7 | +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; |
| 8 | +import com.sap.cloud.sdk.services.openapi.core.OpenApiResponse; |
| 9 | +import com.sap.cloud.sdk.services.openapi.core.AbstractOpenApiService; |
| 10 | +import com.sap.cloud.sdk.services.openapi.apiclient.ApiClient; |
| 11 | + |
| 12 | +import com.sap.cloud.sdk.services.inlineobject.model.NotFound; |
| 13 | +import com.sap.cloud.sdk.services.inlineobject.model.ServiceUnavailableApplicationJson; |
| 14 | +import com.sap.cloud.sdk.services.inlineobject.model.ServiceUnavailableApplicationXml; |
| 15 | +import com.sap.cloud.sdk.services.inlineobject.model.Soda; |
| 16 | + |
| 17 | +import java.util.HashMap; |
| 18 | +import java.util.List; |
| 19 | +import java.util.Locale; |
| 20 | +import java.util.Map; |
| 21 | + |
| 22 | +import org.springframework.util.LinkedMultiValueMap; |
| 23 | +import org.springframework.util.MultiValueMap; |
| 24 | +import org.springframework.web.util.UriComponentsBuilder; |
| 25 | +import org.springframework.core.ParameterizedTypeReference; |
| 26 | +import org.springframework.core.io.FileSystemResource; |
| 27 | +import org.springframework.http.HttpHeaders; |
| 28 | +import org.springframework.http.HttpMethod; |
| 29 | +import org.springframework.http.MediaType; |
| 30 | + |
| 31 | +import javax.annotation.Nonnull; |
| 32 | +import javax.annotation.Nullable; |
| 33 | +import com.google.common.annotations.Beta; |
| 34 | + |
| 35 | +import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; |
| 36 | + |
| 37 | +/** |
| 38 | + * Soda Store API in version 1.0.0. |
| 39 | + * |
| 40 | + * API for managing sodas in a soda store |
| 41 | + */ |
| 42 | +public class DefaultApi extends AbstractOpenApiService { |
| 43 | + /** |
| 44 | + * Instantiates this API class to invoke operations on the Soda Store API. |
| 45 | + * |
| 46 | + * @param httpDestination The destination that API should be used with |
| 47 | + */ |
| 48 | + public DefaultApi( @Nonnull final Destination httpDestination ) |
| 49 | + { |
| 50 | + super(httpDestination); |
| 51 | + } |
| 52 | + |
| 53 | + /** |
| 54 | + * Instantiates this API class to invoke operations on the Soda Store API based on a given {@link ApiClient}. |
| 55 | + * |
| 56 | + * @param apiClient |
| 57 | + * ApiClient to invoke the API on |
| 58 | + */ |
| 59 | + @Beta |
| 60 | + public DefaultApi( @Nonnull final ApiClient apiClient ) |
| 61 | + { |
| 62 | + super(apiClient); |
| 63 | + } |
| 64 | + |
| 65 | + /** |
| 66 | + * <p>Get details of a specific soda</p> |
| 67 | + * <p></p> |
| 68 | + * <p><b>200</b> - The requested soda |
| 69 | + * <p><b>404</b> - The specified resource was not found |
| 70 | + * <p><b>503</b> - The service is currently unavailable |
| 71 | + * @param sodaId |
| 72 | + * ID of the soda to retrieve |
| 73 | + * @return Soda |
| 74 | + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API |
| 75 | + */ |
| 76 | + @Nonnull |
| 77 | + public Soda getSodaById( @Nonnull final Long sodaId) throws OpenApiRequestException { |
| 78 | + final Object localVarPostBody = null; |
| 79 | + |
| 80 | + // verify the required parameter 'sodaId' is set |
| 81 | + if (sodaId == null) { |
| 82 | + throw new OpenApiRequestException("Missing the required parameter 'sodaId' when calling getSodaById"); |
| 83 | + } |
| 84 | + |
| 85 | + // create path and map variables |
| 86 | + final Map<String, Object> localVarPathParams = new HashMap<String, Object>(); |
| 87 | + localVarPathParams.put("sodaId", sodaId); |
| 88 | + final String localVarPath = UriComponentsBuilder.fromPath("/sodas/{sodaId}").buildAndExpand(localVarPathParams).toUriString(); |
| 89 | + |
| 90 | + final MultiValueMap<String, String> localVarQueryParams = new LinkedMultiValueMap<String, String>(); |
| 91 | + final HttpHeaders localVarHeaderParams = new HttpHeaders(); |
| 92 | + final MultiValueMap<String, Object> localVarFormParams = new LinkedMultiValueMap<String, Object>(); |
| 93 | + |
| 94 | + final String[] localVarAccepts = { |
| 95 | + "application/json", "application/xml" |
| 96 | + }; |
| 97 | + final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); |
| 98 | + final String[] localVarContentTypes = { }; |
| 99 | + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); |
| 100 | + |
| 101 | + final String[] localVarAuthNames = new String[] { }; |
| 102 | + |
| 103 | + final ParameterizedTypeReference<Soda> localVarReturnType = new ParameterizedTypeReference<Soda>() {}; |
| 104 | + return apiClient.invokeAPI(localVarPath, HttpMethod.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); |
| 105 | + } |
| 106 | +} |
0 commit comments