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

commonMain.builder.template.TemplateBuilders.kt Maven / Gradle / Ivy

The newest version!
package dev.kord.rest.builder.template

import dev.kord.common.annotation.KordDsl
import dev.kord.common.entity.optional.Optional
import dev.kord.common.entity.optional.delegate.delegate
import dev.kord.common.entity.optional.map
import dev.kord.rest.Image
import dev.kord.rest.builder.RequestBuilder
import dev.kord.rest.json.request.GuildFromTemplateCreateRequest
import dev.kord.rest.json.request.GuildTemplateCreateRequest
import dev.kord.rest.json.request.GuildTemplateModifyRequest

@KordDsl
public class GuildFromTemplateCreateBuilder(public var name: String) : RequestBuilder {

    private var _image: Optional = Optional.Missing()
    public var image: Image? by ::_image.delegate()


    override fun toRequest(): GuildFromTemplateCreateRequest = GuildFromTemplateCreateRequest(
        name, _image.map { it.dataUri }
    )
}

@KordDsl
public class GuildTemplateCreateBuilder(public var name: String) : RequestBuilder {
    private var _description: Optional = Optional.Missing()
    public var description: String? by ::_description.delegate()

    override fun toRequest(): GuildTemplateCreateRequest = GuildTemplateCreateRequest(name, _description)
}

@KordDsl
public class GuildTemplateModifyBuilder : RequestBuilder {

    private var _name: Optional = Optional.Missing()
    public var name: String? by ::_name.delegate()

    private var _description: Optional = Optional.Missing()
    public var description: String? by ::_description.delegate()

    override fun toRequest(): GuildTemplateModifyRequest = GuildTemplateModifyRequest(_name, _description)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy