Skip to content

Latest commit

 

History

History
116 lines (90 loc) · 3.55 KB

README.md

File metadata and controls

116 lines (90 loc) · 3.55 KB

Fineract API Client Library Build Status Jitpack License: MPL 2.0

A Java and Retrofit2 based Fineract Client Library that you can use to interact with the Apache Fineract 1.x Platform. This library is autogenerated using Swagger Codegen. It can be used in Android or any Java and Kotlin Project.

Add Dependency

Gradle

To use library in your gradle project follow the steps below:

  1. Add this in your root build.gradle at the end of repositories:
    allprojects {
        repositories {
            ...
            maven { url 'https://jitpack.io' }
        }
    }
  2. Add the dependency
    dependencies {
        def client_Version = "2.02"
        implementation "com.github.openMF:fineract-client:$client_Version"
    }

Maven

To use the library in your Maven project, follow the steps below:

  1. Add the JitPack repository to your build file:
    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>
  2. Add the dependency
    <dependency>
        <groupId>com.github.openMF</groupId>
        <artifactId>fineract-client</artifactId>
        <version>2.0.2</version>
    </dependency>

Usage

Example code to use the Authentication API:

import io.reactivex.schedulers.Schedulers;
import org.apache.fineract.client.models.PostAuthenticationResponse;
import org.apache.fineract.client.util.FineractClient;
import org.reactivestreams.Subscriber;

public class Main {
   public static void main(String[] args) {
      FineractClient client = FineractClient.builder()
              .basicAuth("mifos", "password")
              .tenant("default")
              .build();
      
      PostAuthenticationRequest body = new PostAuthenticationRequest();
      body.setUsername("mifos");
      body.setPassword("password");
      
      client.authentication.authenticate(body, false)
              .observeOn(Schedulers.newThread()) // use scheduler based on different scenarios, in case of android use 'AndroidSchedulers.mainThread()'
              .subscribeOn(Schedulers.io())
              .subscribe(new Subscriber<PostAuthenticationResponse> (){
                 @Override
                 public void onNext(PostAuthenticationResponse postAuthenticationResponse) {
                    // handle next events here
                 }

                 @Override
                 public void onError(Throwable t) {
                    // handle error events here
                 }

                 @Override
                 public void onComplete() {
                    // handle on completed events here
                 }
              });
   }
}

Build Project

Clone the repository and import as Maven project in IntelliJ IDEA or Eclipse

Before building the project, make sure you have the following things installed.

  • Maven
  • Java 11

To install the API client library to your local Maven repository, simply execute:

mvn install

To build the library using Gradle, execute the following command

./gradlew build

Refer to the official documentation for more information.