Skip to content
This repository has been archived by the owner on May 5, 2021. It is now read-only.

Commit

Permalink
Update Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
CuriousNikhil committed Jan 17, 2019
1 parent e23d382 commit 3039c50
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ class MainActivity : AppCompatActivity() {
async {
val response = await {
val one = get("https://isthisawesome.com/library", auth = BaseAuth("Authorization","awesome:me"), params = mapOf("library" to "Asynkio"))
val two = post("https://youareonfire.com/library", data = mapOf("id" to one.jsonObject["id"]))
return@await two
post("https://youareonfire.com/library", data = mapOf("id" to one.jsonObject["id"]))
}
if (response.statusCode == 200){
result_text.text = response.text
Expand Down
13 changes: 3 additions & 10 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,7 @@

What I mean is..

async {
val response = await {
val one = get("https://isthisawesome.com/library", auth = BaseAuth("Authorization","awesome:me"), params = mapOf("library" to "Asynkio"))
val two = post("https://youareonfire.com/library", data = mapOf("id" to one.jsonObject["id"]))
return@await two
}
if (response.statusCode == 200){
your_are_awesome.text = response.text
}
}
[](_media/index_page.kt ':include :type=code kotlin')

Yes, that's it. No retrofit. No Volley. Java/Kotlin are very bad at handling the http requests, but still `Asynkio` is the optimal way. Seriously...No bullshit!

Expand All @@ -27,3 +18,5 @@ Another example
}.finally {
closeTheFile(filename)
}


14 changes: 14 additions & 0 deletions docs/_media/index_page.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
async {
//All network requests on couroutines
val response = await {
//Get the data
val firstResponse = get("https://isthisawesome.com/library", params = mapOf("library" to "Asynkio"))

//Post the data
return@await post("https://youareonfire.com/library", data = mapOf("id" to firstResponse.jsonObject["id"]))
}
//Process the result on UI thread
if (response.statusCode == 200){
yoTextView.text = response.text
}
}
2 changes: 2 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-php.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-kotlin.js"></script>
<script src="//unpkg.com/docsify-copy-code"></script>
</body>
</html>

0 comments on commit 3039c50

Please sign in to comment.