commonMain.io.revenuemonster.sdk.module.StoreModule.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rm-kotlin-sdk-jvm Show documentation
Show all versions of rm-kotlin-sdk-jvm Show documentation
Revenue Monster Kotlin Multiplatform SDK
package io.revenuemonster.sdk.module
import io.ktor.http.*
import io.revenuemonster.sdk.RevenueMonsterSDK
import io.revenuemonster.sdk.model.Item
import io.revenuemonster.sdk.model.Items
import io.revenuemonster.sdk.model.Response
import io.revenuemonster.sdk.model.common.Store
import io.revenuemonster.sdk.model.request.StoreDetails
class StoreModule(private val sdk: RevenueMonsterSDK) {
suspend fun getStores(): Items {
return sdk.call>("/v3/stores")
}
suspend fun getStoreByID(id: String): Item {
return sdk.call>(
url = "/v3/store/$id"
)
}
suspend fun createStore(data: StoreDetails): Item {
return sdk.call>(
url = "/v3/store",
method = HttpMethod.Post,
body = data
)
}
suspend fun updateStore(storeID: String, data: StoreDetails): Item {
return sdk.call>(
url = "/v3/store/$storeID",
method = HttpMethod.Patch,
body = data
)
}
suspend fun deleteStore(storeID: String): Response {
return sdk.call(
url = "/v3/store/$storeID",
method = HttpMethod.Delete
)
}
}