<commit_before># RuneScape API

## Introduction

`rs-api` is an open-source implementation of a web-service client that allows interaction with the various [RuneScape][rs] APIs, written in [Java][java].

## Usage

The implementation offers functionality to interact with the following three public web-services:

* [Bestiary][bestiary]
* [Grand Exchange][ge]
* [Hiscores][hiscores]

[CSV][csv] and [JSON][json] results are parsed by the API and returned as interactable [Java][java] objects.

To start using `rs-api`, simply instantiate the [RuneScapeAPI][rsapi] class as follows:

```java
RuneScapeAPI api = new RuneScapeAPI();
```

At which point you may now access and query the Bestiary, Grand Exchange, and Hiscores APIs:

```java
	Bestiary bestiary = api.getBestiary();
	GrandExchange grandExchange = api.getGrandExchange();
	Hiscores hiscores = api.getHiscores();
```

## Examples

### Beasts by Level

Calling the `beastsInLevelGroup` method with the lower and upper combat level bounds as parameters (e.g. 250 and 300) in the [Bestiary API][bestiary-api] will return an [ImmutableMap][immutablemap] of beast IDs to beast names, containing only beasts that have a combat level between the lower and upper bounds inclusively.

```java
RuneScapeAPI api = new RuneScapeAPI();
ImmutableMap<Integer, String> beasts = api.getBestiary().beastsInLevelGroup(250, 300);

System.out.println("Results:");
for (Map.Entry<Integer, String> entry : beasts.entrySet()) {
	System.out.println("\t[" + String.format("%05d", entry.getKey()) + "] " + entry.getValue());
}
```

Outputs:

```
Results:
	[00050] King Black Dragon (276)
	[15206] TokHaar-Yt-MejKot (300)
```

### Player Hiscore Rank

Calling the `playerInformation` method with a player's name as a parameter (e.g. Drumgun) and a Hiscore [Table][table] as a parameter (e.g. `Table.DEFAULT`) in the [Hiscores API][hiscores-api] will return the hiscore information for the [Player][player], including skill levels and activity ranks.

```java
RuneScapeAPI api = new RuneScapeAPI();
Optional<Player> optional = hiscores.playerInformation("Drumgun", Table.DEFAULT);

optional.ifPresent(player -> System.out.println("Overall rank: " + player.getSkills().get("Overall")));
```

Outputs:

```
Overall rank: Skill{rank=1, level=2595, experience=5200000000}
```
<commit_msg>Added an example of the graphing data function to the README<commit_after># RuneScape API

## Introduction

`rs-api` is an open-source implementation of a web-service client that allows interaction with the various [RuneScape][rs] APIs, written in [Java][java].

## Usage

The implementation offers functionality to interact with the following three public web-services:

* [Bestiary][bestiary]
* [Grand Exchange][ge]
* [Hiscores][hiscores]

[CSV][csv] and [JSON][json] results are parsed by the API and returned as interactable [Java][java] objects.

To start using `rs-api`, simply instantiate the [RuneScapeAPI][rsapi] class as follows:

```java
RuneScapeAPI api = new RuneScapeAPI();
```

At which point you may now access and query the Bestiary, Grand Exchange, and Hiscores APIs:

```java
	Bestiary bestiary = api.getBestiary();
	GrandExchange grandExchange = api.getGrandExchange();
	Hiscores hiscores = api.getHiscores();
```

## Examples

### Beasts by Level

Calling the `beastsInLevelGroup` method with the lower and upper combat level bounds as parameters (e.g. 250 and 300) in the [Bestiary API][bestiary-api] will return an [ImmutableMap][immutablemap] of beast IDs to beast names, containing only beasts that have a combat level between the lower and upper bounds inclusively.

```java
RuneScapeAPI api = new RuneScapeAPI();
ImmutableMap<Integer, String> beasts = api.getBestiary().beastsInLevelGroup(250, 300);

System.out.println("Results:");
for (Map.Entry<Integer, String> entry : beasts.entrySet()) {
	System.out.println("\t[" + String.format("%05d", entry.getKey()) + "] " + entry.getValue());
}
```

Outputs:

```
Results:
	[00050] King Black Dragon (276)
	[15206] TokHaar-Yt-MejKot (300)
```

### Item Price on Day

Calling the `graphingData` method with an item's ID as the parameter (e.g. 4151 for an Abyssal whip) will return the price information that may be used for graphical repersentation of an item's price history.

```java
RuneScapeAPI api = new RuneScapeAPI();
Optional<GraphingData> optional = api.getGrandExchange().graphingData(4151);

optional.ifPresent(graphingData -> {
	Calendar calendar = Calendar.getInstance();
	calendar.setTimeZone(TimeZone.getTimeZone("GMT"));
	calendar.set(Calendar.MILLISECOND, 0);
	calendar.set(2014, Calendar.DECEMBER, 25, 0, 0, 0);
	
	System.out.println("Daily price on Christmas 2014: " + graphingData.getDailyValue(calendar.getTime()).get());
});
```

Outputs:

```
Daily price on Christmas 2014: 117549
```

### Player Hiscore Rank

Calling the `playerInformation` method with a player's name as a parameter (e.g. Drumgun) and a Hiscore [Table][table] as a parameter (e.g. `Table.DEFAULT`) in the [Hiscores API][hiscores-api] will return the hiscore information for the [Player][player], including skill levels and activity ranks.

```java
RuneScapeAPI api = new RuneScapeAPI();
Optional<Player> optional = hiscores.playerInformation("Drumgun", Table.DEFAULT);

optional.ifPresent(player -> System.out.println("Overall rank: " + player.getSkills().get("Overall")));
```

Outputs:

```
Overall rank: Skill{rank=1, level=2595, experience=5200000000}
```

{'fraction_non_alphanumeric': 0.1265403715284164, 'fraction_numerical': 0.022438844951259886, 'mean_word_length': 5.607533414337788, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1104811', 'n_tokens_mistral': 1849, 'n_tokens_neox': 1646, 'n_words': 564}