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

commonMain.com.algolia.search.dsl.attributes.DSLAttributesSet.kt Maven / Gradle / Ivy

Go to download

"Algolia is a powerful search-as-a-service solution, made easy to use with API clients, UI libraries, and pre-built integrations. Algolia API Client for Kotlin lets you easily use the Algolia Search REST API from your JVM project, such as Android or backend implementations."

There is a newer version: 3.12.2
Show newest version
package com.algolia.search.dsl.attributes

import com.algolia.search.dsl.DSL
import com.algolia.search.dsl.DSLParameters
import com.algolia.search.model.Attribute

/**
 * DSL for building a [Set] of [Attribute].
 */
@DSLParameters
public class DSLAttributesSet(
    private val attributes: MutableSet = mutableSetOf()
) {

    /**
     * Convenience method.
     */
    public operator fun String.unaryPlus() {
        +Attribute(this)
    }

    /**
     * Add [this] to [attributes].
     */
    public operator fun Attribute.unaryPlus() {
        attributes += this
    }

    public companion object : DSL> {

        override operator fun invoke(block: DSLAttributesSet.() -> Unit): Set {
            return DSLAttributesSet().apply(block).attributes
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy