fun renderOperationDefinition()

in smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/ServiceGenerator.kt [42:76]


        fun renderOperationDefinition(
            model: Model,
            symbolProvider: SymbolProvider,
            writer: SwiftWriter,
            opIndex: OperationIndex,
            op: OperationShape,
            insideProtocol: Boolean = false
        ) {
            val operationName = op.camelCaseName()
            // Theoretically this shouldn't happen since we insert empty input/outputs for operations that don't have one or the other to allow for sdk evolution
            if (!op.input.isPresent || !op.output.isPresent) throw CodegenException("model should have been preprocessed to ensure operations always have an input or output shape: $op.id")

            val inputShape = opIndex.getInput(op).get()
            val inputShapeName = symbolProvider.toSymbol(inputShape).name
            val inputParam = "input: $inputShapeName"

            val outputType = createOutputType(opIndex, op, symbolProvider)
            val outputParam = "completion: @escaping ($outputType) -> Void"

            val paramTerminator = ", "
            if (op.id.name == "createBucket") {
                print("we are here")
            }
            writer.writeShapeDocs(op)
            writer.writeAvailableAttribute(model, op)

            val accessSpecifier = if (insideProtocol) "" else "public "

            writer.write(
                "${accessSpecifier}func \$L(\$L${paramTerminator}\$L)",
                operationName,
                inputParam,
                outputParam
            )
        }