commonMain.builder.template.TemplateBuilders.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kord-rest Show documentation
Show all versions of kord-rest Show documentation
Idiomatic Kotlin Wrapper for The Discord API
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)
}