commonMain.service.SubscriptionService.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.service
import dev.kord.common.entity.DiscordSubscription
import dev.kord.common.entity.Snowflake
import dev.kord.rest.json.request.SkuSubscriptionsListRequest
import dev.kord.rest.request.RequestHandler
import dev.kord.rest.route.Route
public class SubscriptionService(requestHandler: RequestHandler) : RestService(requestHandler) {
public suspend fun listSkuSubscriptions(
skuId: Snowflake,
request: SkuSubscriptionsListRequest,
): List = call(Route.SkuSubscriptionsList) {
keys[Route.SkuId] = skuId
request.position?.let { parameter(it.key, it.value) }
request.limit?.let { parameter("limit", it) }
request.userId?.let { parameter("user_id", it) }
}
public suspend fun getSkuSubscription(
skuId: Snowflake,
subscriptionId: Snowflake,
): DiscordSubscription = call(Route.SkuSubscriptionGet) {
keys[Route.SkuId] = skuId
keys[Route.SubscriptionId] = subscriptionId
}
}