asavill
07/10/2021, 12:50 PMfun get(): Array<TestClassFailures> {
return Json.decodeFromDynamic(Results.serializer(), io.kvision.require("test_failures.json")).testClassFailures
}
This was great for testing, but I’d like to move away from this. Unfortunately my json data isn’t available via a REST api to just pull it down. The reality is much more “primitive”. I have an S3 bucket that just occasionally gets a new json file added to it. I’d like the resulting application built from the kvision project to pull this new file in (they would be sat at the same level, so the json file would be added to the “index” folder). I’ve tried replacing the json file that gets added to .zip that gets generated when the application is built, but this seems to be ignored. The json file appears to be injected into the .js files directly.
It this possible?Hywel Bennett
07/10/2021, 7:56 PMsuspend fun getStuff(): Array<TestClassFailures> {
return RestClient().request<Array<TestClassFailures>>("test_failures.json", method = HttpMethod.GET).await().data
}
fun getStuffPromise() {
RestClient().request<Array<TestClassFailures>>("test_failures.json", method = HttpMethod.GET)
.then { it.data }
.then { failures: Array<TestClassFailures> -> /*Use failures here*/ }
}
Hope that helpsRobert Jaros
07/10/2021, 8:11 PMHywel Bennett
07/10/2021, 8:12 PMasavill
07/11/2021, 3:29 PM