An open API service indexing awesome lists of open source software.

https://github.com/smirltech/goma


https://github.com/smirltech/goma

Last synced: 4 months ago
JSON representation

Awesome Lists containing this project

README

          

# Android Kotlin Goma http protocol client Library

[![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-yellow.svg)](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.