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

commonMain.aws.sdk.kotlin.services.lexmodelbuildingservice.model.FulfillmentActivity.kt Maven / Gradle / Ivy

The newest version!
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.lexmodelbuildingservice.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * Describes how the intent is fulfilled after the user provides all of the information required for the intent. You can provide a Lambda function to process the intent, or you can return the intent information to the client application. We recommend that you use a Lambda function so that the relevant logic lives in the Cloud and limit the client-side code primarily to presentation. If you need to update the logic, you only update the Lambda function; you don't need to upgrade your client application.
 *
 * Consider the following examples:
 * + In a pizza ordering application, after the user provides all of the information for placing an order, you use a Lambda function to place an order with a pizzeria.
 * + In a gaming application, when a user says "pick up a rock," this information must go back to the client application so that it can perform the operation and update the graphics. In this case, you want Amazon Lex to return the intent data to the client.
 */
public class FulfillmentActivity private constructor(builder: Builder) {
    /**
     * A description of the Lambda function that is run to fulfill the intent.
     */
    public val codeHook: aws.sdk.kotlin.services.lexmodelbuildingservice.model.CodeHook? = builder.codeHook
    /**
     * How the intent should be fulfilled, either by running a Lambda function or by returning the slot data to the client application.
     */
    public val type: aws.sdk.kotlin.services.lexmodelbuildingservice.model.FulfillmentActivityType = requireNotNull(builder.type) { "A non-null value must be provided for type" }

    public companion object {
        public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.lexmodelbuildingservice.model.FulfillmentActivity = Builder().apply(block).build()
    }

    override fun toString(): kotlin.String = buildString {
        append("FulfillmentActivity(")
        append("codeHook=$codeHook,")
        append("type=$type")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = codeHook?.hashCode() ?: 0
        result = 31 * result + (type.hashCode())
        return result
    }

    override fun equals(other: kotlin.Any?): kotlin.Boolean {
        if (this === other) return true
        if (other == null || this::class != other::class) return false

        other as FulfillmentActivity

        if (codeHook != other.codeHook) return false
        if (type != other.type) return false

        return true
    }

    public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.lexmodelbuildingservice.model.FulfillmentActivity = Builder(this).apply(block).build()

    @SdkDsl
    public class Builder {
        /**
         * A description of the Lambda function that is run to fulfill the intent.
         */
        public var codeHook: aws.sdk.kotlin.services.lexmodelbuildingservice.model.CodeHook? = null
        /**
         * How the intent should be fulfilled, either by running a Lambda function or by returning the slot data to the client application.
         */
        public var type: aws.sdk.kotlin.services.lexmodelbuildingservice.model.FulfillmentActivityType? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.lexmodelbuildingservice.model.FulfillmentActivity) : this() {
            this.codeHook = x.codeHook
            this.type = x.type
        }

        @PublishedApi
        internal fun build(): aws.sdk.kotlin.services.lexmodelbuildingservice.model.FulfillmentActivity = FulfillmentActivity(this)

        /**
         * construct an [aws.sdk.kotlin.services.lexmodelbuildingservice.model.CodeHook] inside the given [block]
         */
        public fun codeHook(block: aws.sdk.kotlin.services.lexmodelbuildingservice.model.CodeHook.Builder.() -> kotlin.Unit) {
            this.codeHook = aws.sdk.kotlin.services.lexmodelbuildingservice.model.CodeHook.invoke(block)
        }

        internal fun correctErrors(): Builder {
            if (type == null) type = FulfillmentActivityType.SdkUnknown("no value provided")
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy