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

commonMain.service.SubscriptionService.kt Maven / Gradle / Ivy

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
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy