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

commonMain.io.revenuemonster.sdk.module.StoreModule.kt Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
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
        )
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy