https://github.com/smirltech/goma
https://github.com/smirltech/goma
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/smirltech/goma
- Owner: smirltech
- License: apache-2.0
- Created: 2021-03-19T17:50:37.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-28T10:33:07.000Z (over 5 years ago)
- Last Synced: 2025-10-20T00:41:55.198Z (8 months ago)
- Size: 172 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Android Kotlin Goma http protocol client Library
[](http://www.apache.org/licenses/LICENSE-2.0)
## Supported methods
GET, POST, PUT, DELETE
## Download and Import
### Android Studio/Gradle
- Maven:
```groovy
jitpack.io
https://jitpack.io
com.github.jkanTech
goma
1.0.3
```
- JitPack.io, add `jitpack.io` repositiory and dependency to your `build.gradle`:
```groovy
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
implementation 'com.github.jkantech:goma:1.0.3'
}
```
### Android Studio
```groovy
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
implementation 'com.github.jkantech:goma:1.0.3'
}
```
### Manifests
```xml
= HashMap()
parameters.put("appKey","12345#")
parameters.put("name","Jonas")
parameters.put("title","Inform")
parameters.put("age","18")
//POST Method ,path
Goma.post("http://192.168.8.101/api/v1/add",parameters, object : OnResponseListener {
override fun onSuccess(response: String?) {
Toast.makeText(requireContext(), "Successfully added", Toast.LENGTH_SHORT).show()
}
override fun onError(error: String?) {
Toast.makeText(requireContext(), error.toString(), Toast.LENGTH_SHORT).show()
}
})
}
```
#### PUT Method
```kotlin
private fun add(){
// initialize Goma Library
Goma.init(this)
val parameters: HashMap = HashMap()
parameters["Appkey"] = "12345"
parameters["name"] = "Bob"
parameters["title"] = "Infor"
parameters["age"] = "30"
Goma.put("http://192.168.8.101/api/v1/adduser", parameters,object :OnResponseListener {
override fun onSuccess(response: String?) {
Toast.makeText(this, response.toString(), Toast.LENGTH_SHORT).show()
}
override fun onError(error: String?) {
Toast.makeText(this, response.toString(), Toast.LENGTH_SHORT).show()
}
})
}
```
#### DELETE Method
```kotlin
private fun delUser(){
// initialize Goma Library
Goma.init(this)
val parameters:HashMap = HashMap()
parameters.put("appKey","12345#")
parameters.put("id","4")
//DELETE Method ,URL
Goma.del("http://192.168.43.128/api/delUser",parameters, object : OnResponseListener {
override fun onSuccess(response: String?) {
Toast.makeText(requireContext(), "Successfully deleted", Toast.LENGTH_SHORT).show()
}
override fun onError(error: String?) {
Toast.makeText(requireContext(), error.toString(), Toast.LENGTH_SHORT).show()
}
})
}
```
Examples :eyes:
Download the [Goma Example App]() or look at the [source code](https://github.com/jkanTech/goma/tree/master/CrudExample).
## Authors
* **Jonas Kaninda** - [jkanTech](https://github.com/jkantech)
## License
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.