import me.gilo.woodroid.Woocommerce
import me.gilo.woodroid.models.Product
import retrofit2.*
fun main() {
val siteUrl = "https://si.te/"
val ConsumerKey = "ck_key"
val ConsumerSecret = "cs_secret"
WooComerceProvider(siteUrl, ConsumerKey, ConsumerSecret).loadProducts()
}
class WooComerceProvider(site: String, key: String, secretKey: String) {
private val woocommerce = Woocommerce.Builder()
.setSiteUrl(site)
.setApiVersion(Woocommerce.API_V3)
.setConsumerKey(key)
.setConsumerSecret(secretKey)
.build()
fun loadProducts() {
var products: MutableList<Product> = mutableListOf()
woocommerce.ProductRepository().products().enqueue(object : Callback<List<Product>> {
override fun onResponse(call: Call<List<Product>>, response: Response<List<Product>>) {
val productsResponse = response.body()
for (product in productsResponse!!) {
products.add(product)
}
}
override fun onFailure(call: Call<List<Product>>, t: Throwable) {
}
})
}
}
and there are more errors
Exception in thread "OkHttp Dispatcher" java.lang.RuntimeException: Stub!
at org.apache.http.message.BasicNameValuePair.(BasicNameValuePair.java:121)
at me.gilo.woodroid.data.auth.AuthIntercepter.getOauthParams(AuthIntercepter.java:90)
at me.gilo.woodroid.data.auth.AuthIntercepter.intercept(AuthIntercepter.java:43)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.kt:184)
at okhttp3.RealCall$AsyncCall.run(RealCall.kt:136)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Woocommerce.Builder() worked, but the query did not. Sorry, it seems I don't really understand. Could you help me to install/use your package?
I already manually add some implementations because of errors
Did I have to do that?
and there are more errors
Woocommerce.Builder() worked, but the query did not. Sorry, it seems I don't really understand. Could you help me to install/use your package?