All Downloads are FREE. Search and download functionalities are using the official Maven repository.

macros.syncclientclass.api-gateway.ClientMethodForOperation.ftl Maven / Gradle / Ivy

<#macro content metadata operationModel>

    ${operationModel.getSyncDocumentation(metadata)!""}
    @Override
    <#if operationModel.deprecated>
        @Deprecated
    
    public ${operationModel.syncReturnType} ${operationModel.methodName}(${operationModel.input.variableType} ${operationModel.input.variableName}) {
        HttpResponseHandler<${operationModel.returnType.returnType}> responseHandler =
            protocolFactory.createResponseHandler(new JsonOperationMetadata()
                .withPayloadJson(${(!operationModel.hasBlobMemberAsPayload)?c})
                <#if operationModel.outputShape??>
                .withHasStreamingSuccessResponse(${operationModel.outputShape.hasStreamingMember?c})
                <#else>
                .withHasStreamingSuccessResponse(false)
                
            , new ${operationModel.syncReturnType}${metadata.unmarshallerClassSuffix}());

        HttpResponseHandler errorResponseHandler = createErrorResponseHandler(
        <#if operationModel.exceptions??>
            <#list operationModel.exceptions as exception>
                new JsonErrorShapeMetadata()
                    .withModeledClass(${exception.exceptionName}.class)
                    .withHttpStatusCode(${exception.httpStatusCode})<#sep>, 
            
        
        );

        return clientHandler.execute(
                new ClientExecutionParams<${operationModel.input.variableType}, ${operationModel.returnType.returnType}>()
                        .withMarshaller(<@RequestMarshallerCreation.content operationModel />)
                        .withResponseHandler(responseHandler)
                        .withErrorResponseHandler(errorResponseHandler)
                        .withInput(${operationModel.input.variableName}));
    }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy