Baka4J

Select a theme

Baka4J is unofficial wrapper for Bakaláři API v3. It provides a simple way to interact with some api endpoints. The client is build using OKHttp client.

How to use

This repository is not hosted anywhere. You need to build it yourself. This project has been created using openjdk 18.

You can start by referencing BakaClient. That is an interface having methods for instancing clients.

import com.panjohnny.baka4j.BakaClient;

public class Test {
    {
        BakaClient client = BakaClient.v3(url) | BakaClient.v3Wrapper(url);
    }
}

This will create the BakaClient instance, but this will just provide you with options to login and nothing more. You should use the correct interface when creating object.

import com.panjohnny.baka4j.BakaClient;
import com.panjohnny.baka4j.v3.V3Client;
import com.panjohnny.baka4j.v3.V3WrapperClient;

public class Test {
    {
        V3Client client = BakaClient.v3(url);
        V3WrapperClient wrapperClient = BakaClient.v3Wrapper(url);
    }
}

Now you can call the methods. This repository provides javadocs with links to unofficial bakaláři api v3 docs.

Unit testing

If you want to unit test this repo you can create file login.json in src/test/resources/ with the following layout.

{
  "username": "JohnDoe",
  "password": "ILikeCats",
  "url": "https://bakalari.example.com/"
}

Look into src/test/java to see unit tests.

Contribute

Any contribution to this project is welcome. Create pull requests and issues. If you add new endpoint please provide an unit test.

Project info

Tags

Links