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

commonMain.aws.sdk.kotlin.services.cloudsearchdomain.serde.SearchOperationSerializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.cloudsearchdomain.serde

import aws.sdk.kotlin.services.cloudsearchdomain.model.QueryParser
import aws.sdk.kotlin.services.cloudsearchdomain.model.SearchRequest
import aws.smithy.kotlin.runtime.http.HttpBody
import aws.smithy.kotlin.runtime.http.HttpMethod
import aws.smithy.kotlin.runtime.http.operation.HttpSerializer
import aws.smithy.kotlin.runtime.http.request.HttpRequestBuilder
import aws.smithy.kotlin.runtime.http.request.url
import aws.smithy.kotlin.runtime.operation.ExecutionContext
import aws.smithy.kotlin.runtime.text.encoding.PercentEncoding


internal class SearchOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: SearchRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.GET

        builder.url {
            path.encoded = "/2013-01-01/search"
            parameters.decodedParameters {
                add("format", "sdk")
                add("pretty", "true")
            }
            parameters.decodedParameters(PercentEncoding.SmithyLabel) {
                if (input.cursor != null) add("cursor", input.cursor)
                if (input.expr != null) add("expr", input.expr)
                if (input.facet != null) add("facet", input.facet)
                if (input.filterQuery != null) add("fq", input.filterQuery)
                if (input.highlight != null) add("highlight", input.highlight)
                if (input.partial != null) add("partial", input.partial.toString())
                if (input.query != null) add("q", input.query)
                if (input.queryOptions != null) add("q.options", input.queryOptions)
                if (input.queryParser != null) add("q.parser", input.queryParser.value)
                if (input.`return` != null) add("return", input.`return`)
                if (input.size != null) add("size", input.size.toString())
                if (input.sort != null) add("sort", input.sort)
                if (input.start != null) add("start", input.start.toString())
                if (input.stats != null) add("stats", input.stats)
            }
        }

        return builder
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy