simple-call-api

This lib is a simple call APIs

License

License

GroupId

GroupId

com.github.mattyoliveira
ArtifactId

ArtifactId

simple-call-api
Last Version

Last Version

2.0.0
Release Date

Release Date

Type

Type

aar
Description

Description

simple-call-api
This lib is a simple call APIs
Project URL

Project URL

https://github.com/MattyOliveira/SimpleCallApi
Source Code Management

Source Code Management

https://github.com/MattyOliveira/SimpleCallApi

Download simple-call-api

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.mattyoliveira/simple-call-api/ -->
<dependency>
    <groupId>com.github.mattyoliveira</groupId>
    <artifactId>simple-call-api</artifactId>
    <version>2.0.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.mattyoliveira/simple-call-api/
implementation 'com.github.mattyoliveira:simple-call-api:2.0.0'
// https://jarcasting.com/artifacts/com.github.mattyoliveira/simple-call-api/
implementation ("com.github.mattyoliveira:simple-call-api:2.0.0")
'com.github.mattyoliveira:simple-call-api:aar:2.0.0'
<dependency org="com.github.mattyoliveira" name="simple-call-api" rev="2.0.0">
  <artifact name="simple-call-api" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.github.mattyoliveira', module='simple-call-api', version='2.0.0')
)
libraryDependencies += "com.github.mattyoliveira" % "simple-call-api" % "2.0.0"
[com.github.mattyoliveira/simple-call-api "2.0.0"]

Dependencies

compile (10)

Group / Artifact Type Version
org.jetbrains.kotlinx : kotlinx-coroutines-core jar 1.4.2
org.jetbrains.kotlinx : kotlinx-coroutines-android jar 1.4.2
com.squareup.retrofit2 : adapter-rxjava2 jar 2.9.0
org.jetbrains.kotlin : kotlin-stdlib jar 1.4.30
androidx.core » core-ktx jar 1.3.2
androidx.appcompat » appcompat jar 1.2.0
com.google.android.material » material jar 1.3.0
com.squareup.moshi : moshi-kotlin jar 1.11.0
com.squareup.retrofit2 : converter-gson jar 2.9.0
com.squareup.retrofit2 : converter-moshi jar 2.9.0

Project Modules

There are no modules declared in this project.

SimpleCallApi

SimpleCallApi is a library to assist with API calls. The idea is that it would be as simple as possible and could help from the beginner to the most senior developer. SimpleCallApi supports Coroutines and RxJava

GitHub stars GitHub watchers GitHub followers GitHub issues GitHub version

Version

Gradle
implementation 'com.github.mattyoliveira:simple-call-api:2.0.0'
Maven
<dependency>
  <groupId>com.github.mattyoliveira</groupId>
  <artifactId>simple-call-api</artifactId>
  <version>2.0.0</version>
  <type>aar</type>
</dependency>

Example

ApiService
interface Api {
    @GET("/api")
    suspend fun getExemple(): yourType
}
NetworkConfig
createClientByService<Api>( baseUrl = "https://yourBase")
SimpleRespository
class ExempleRepository(val api: Api) {
	suspend fun getExemple() = api.getExemple()
}
SimpleUseCase
class ExempleUseCase(private val repositori: MainRepository) : SimpleUseCase<Post, None>(){
    override suspend fun run(params: None) = repositori.getExemple()
}
SimpleViewModel
class ExempleViewModel(private val useCase: ExempleUseCase) {

	fun getExemple() {
		viewModelScope.launch {
		    useCase(scope = this)
			.onStatusChange {
			    when(it) {
				AsyncStatus.DONE -> { //FinishOperation }
				AsyncStatus.RUNNING -> { //RunningOperation }
				AsyncStatus.ERROR -> { //ErrorOperation }
			    }
			}
                	.onSuccess { it //return your type }
                	.onFailure { it //return ErrorEntity  }
        	}
	}
}

Technology

SimpleCallApi uses the Retrofit2, Coroutines, RxJava2, Moshi and Gson libraries.

License

Apache License, Version 2.0

Versions

Version
2.0.0
1.2.3
1.2.1
1.1.1
1.0.1
1.0.0
0.0.5
0.0.3
0.0.2
0.0.1