Skip to content

Commit

Permalink
updated the README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshiCodes committed May 18, 2024
1 parent 691031b commit 1b98297
Showing 1 changed file with 44 additions and 3 deletions.
47 changes: 44 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# ☕ AGHPB4J 📚
<sub>Java Wrapper for the anime girls holding programming books [API](https://api.devgoldy.xyz/aghpb/v1/docs).

![GitHub Release](https://img.shields.io/github/v/release/JoshiCodes/AGHPB4J?include_prereleases&sort=date&display_name=release)

</div>

<div align="center">
Expand All @@ -11,12 +13,33 @@

> [!Note]
>
> I am not the original author of the aghpb API. You can view their Wrappers for other Languages [here](https://github.com/THEGOLDENPRO/aghpb_api#-api-wrappers).
> I am not the original author of the AGHPB API. You can view their Wrappers for other Languages [here](https://github.com/THEGOLDENPRO/aghpb_api#-api-wrappers).
This Wrapper is based on the [AGHPB API](https://github.com/THEGOLDENPRO/aghpb_api/). It is a simple Java Wrapper that allows you to interact with the API in a more convenient way.

## Installation
// TODO
To use this Wrapper, you need to add the following repository and dependency to your `pom.xml` file.
Replace `VERSION` with the latest version found [here](https://github.com/JoshiCodes/AGHPB4J/releases).

```xml
<repositories>
<repository>
<id>joshicodes-de-releases</id>
<name>JoshiCodes Repository</name>
<url>https://repo.joshicodes.de/releases</url>
</repository>
</repositories>
```

```xml
<dependencies>
<dependency>
<groupId>de.joshicodes</groupId>
<artifactId>AGHPB4J</artifactId>
<version>VERSION</version>
</dependency>
</dependencies>
```

## Usage
To use the API, you first need to create a new AGHPB object. You can do this by calling the constructor and passing the URL of the API as a parameter.
Expand All @@ -25,4 +48,22 @@ To use the API, you first need to create a new AGHPB object. You can do this by
AGHPB aghpb = new AGHPB("http://localhost:5000");
// If no url is provided, the default public api will be used (https://api.devgoldy.xyz/aghpb/v1/)
AGHPB aghpb = new AGHPB();
```
```

After creating the object, just use one of the available methods.
Almost every method, returns a RestAction Object. To execute the request, you need to call the `#execute()` method.
This method is blocking and will return the result.
If you want to execute the request asynchronously, you can use the `#queue()` method.
This method will return `void`, but can take a `Consumer` as a parameter, which will be called when the request is completed.


#### Methods
- `AGHPB#retrieveStatus()` - `ApiStatus`
Returns the status of the API.
- `AGHPB#retrieveInfo()` - `ApiInfo`
Returns the info of the API.
- `AGHPB#retrieveAllCategories(boolean cache)` - `List<String>`
Returns a list of all available categories.
If `cache` is true, the result will be cached and can be returned with `AGHPB#getCategories()`.
- `AGHPB#retrieveRandomImage(@Nullable String category, @Nullable AGHPBook.BookImageType type)` - `AGHPBook`
Returns a random image. Both parameters are optional and alternatively you can use the `AGHPB#retrieveRandomImage()` method without parameters or with only one parameter.

0 comments on commit 1b98297

Please sign in to comment.