Skip to content

Commit 3bfc31e

Browse files
committed
#22 - Update README and other docs
1 parent c39e6cd commit 3bfc31e

File tree

4 files changed

+48
-7
lines changed

4 files changed

+48
-7
lines changed

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<p align="center">
22
<img src="https://user-images.githubusercontent.com/22875520/119843615-b6da3f80-bed5-11eb-8d3e-b2432a993454.png">
3+
<a href="https://discord.gg/dvZmP92d4h"><img src="https://discordapp.com/api/guilds/847480795232993280/widget.png?style=banner2"></a>
34
</p>
45

5-
[![Discord Banner 2](https://discordapp.com/api/guilds/847480795232993280/widget.png?style=banner2)](https://discord.gg/dvZmP92d4h)
6-
76
# JavaDestinyAPI
87
This library is used as an interface to the API for the game Destiny 2, created by Bungie.
98

@@ -37,7 +36,8 @@ You need to get an API key from [bungie.net/developer](https://bungie.net/develo
3736
```java
3837
DestinyAPI api = new DestinyAPI().setApiKey("YOUR API KEY HERE");
3938
```
40-
*Must be intialized before any parts of the API are used!*
39+
**IMPORTANT:** *DestinyAPI MUST be the first thing initialized before making any interactions with the API! This is because
40+
all interactions with the API rely on the API Key set in DestinyAPI.*
4141

4242
**Getting the time played in hours, of the user named dec4234#9904**
4343
```java
@@ -51,13 +51,19 @@ System.out.println(new Clan("Heavenly Mayhem").getFounder().getSupplementalDispl
5151

5252
Check out the [wiki](https://github.com/dec4234/JavaDestinyAPI/wiki/Getting-Started) for more specific examples and information.
5353

54+
### An aside about APIException
55+
As of 4/30/2024, all functions that interact with the API in any way (i.e. could make an HTTP request) throw APIException.
56+
This is to allow for you, the user, to handle API errors in the way you see fit. This means you must use a try/catch or
57+
add "throws" to your function signature.
58+
<br>
59+
This was done because the old way could create a lot of runtime exceptions which were hard to account for.
60+
The most important error you may want to look at is [APIOfflineException](https://github.com/dec4234/JavaDestinyAPI/blob/master/src/main/java/net/dec4234/javadestinyapi/exceptions/APIOfflineException.java)
61+
which indicates when Bungie has disabled the API for maintenence. This may be useful to tell your user's that the API is offline.
62+
5463
## How's it made?
5564
There is both official and unofficial documentation for the API available on [destinydevs.github.io](http://destinydevs.github.io/BungieNetPlatform/docs/Endpoints) and on the [offical bungie api documentation](https://bungie-net.github.io/).
5665

5766
### TO-DO
5867
- Managing inventory / Item transferring
5968
- Collections / Triumphs
60-
- Revamping the wiki
61-
62-
### Contributing
63-
All development since 3/10/2022 on new features occurs within the [dev](https://github.com/dec4234/JavaDestinyAPI/tree/dev) branch. Clone that and submit a pull request with your changes.
69+
- Revamping the wiki

src/main/java/net/dec4234/javadestinyapi/material/inventory/items/InventoryItem.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
import java.util.ArrayList;
1818
import java.util.List;
1919

20+
/**
21+
* An InventoryItem describes any item contained in a player's or one of their characters inventories.
22+
* This could be a weapon, armor piece, ghost, etc.
23+
* <p>
24+
* This class is currently incomplete. If you would like to contribute, please create a pull request on GitHub
25+
*/
2026
public class InventoryItem extends DestinyItem {
2127

2228
private static HttpUtils httpUtils = DestinyAPI.getHttpUtils();

src/main/java/net/dec4234/javadestinyapi/material/inventory/loadouts/Loadout.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
import java.util.ArrayList;
1414
import java.util.List;
1515

16+
/**
17+
* This class is currently incomplete. If you would like to contribute, please create a pull request on GitHub
18+
*/
1619
public class Loadout {
1720

1821
private String colorHash;

src/main/java/net/dec4234/javadestinyapi/material/user/DestinyCharacter.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
import java.util.Date;
2626
import java.util.List;
2727

28+
/**
29+
* A DestinyCharacter is a character on a user's account like a Warlock, Titan, or Hunter.
30+
* <br>
31+
* There is a lot of character-specific information that is captured within this class.
32+
*/
2833
public class DestinyCharacter extends ContentFramework {
2934

3035
private BungieUser bungieUser;
@@ -221,6 +226,12 @@ public InventoryItem getItemInSlot(InventoryItem.ItemLocation itemLocation) {
221226
}
222227
*/
223228

229+
/**
230+
* Get a list of inventory items present in this character's inventory.
231+
* <br>
232+
* This is an OAUTH action that required inventory reading permission.
233+
* @return A list of inventory items, equipped or unequipped
234+
*/
224235
public List<InventoryItem> getAllItemsInInventory() throws APIException {
225236
JsonArray jsonArray = hu.urlRequestGETOauth("https://www.bungie.net/Platform/Destiny2/" + getMembershipType() + "/Profile/" + bungieUser.getID() + "/Character/"
226237
+ getCharacterID() + "/?components=201").getAsJsonObject("Response").getAsJsonObject("inventory").getAsJsonObject("data").getAsJsonArray("items");
@@ -249,6 +260,12 @@ public List<InventoryItem> getAllItemsInInventory() throws APIException {
249260
return list;
250261
}
251262

263+
/**
264+
* TODO: complete
265+
* <br>
266+
* This function is currently incomplete. If you would like to contribute, please create a pull request on GitHub
267+
* @return A list of loadouts on this character
268+
*/
252269
public List<Loadout> getLoadouts() throws APIException {
253270
hu.urlRequestGETOauth(HttpUtils.URL_BASE + "/Destiny2/" + getMembershipType() + "/Profile/" + bungieUser.getID() + "/Character/" + getCharacterID() + "/?components=206,201");
254271

@@ -339,6 +356,9 @@ private Race evaluateRace(String raceHash) throws APIException {
339356
return null;
340357
}
341358

359+
/**
360+
* Gender of this character. Male or Female
361+
*/
342362
public enum Gender {
343363
MALE("Male"),
344364
FEMALE("Female");
@@ -353,6 +373,9 @@ private Gender(String value) {
353373

354374
}
355375

376+
/**
377+
* The class of this character. Hunter, Titan or Warlock
378+
*/
356379
public enum DestinyClass {
357380
HUNTER("Hunter"),
358381
TITAN("Titan"),
@@ -367,6 +390,9 @@ private DestinyClass(String value) {
367390
public String getValue() { return value; }
368391
}
369392

393+
/**
394+
* The race of this character. Awoken, Exo or Human
395+
*/
370396
public enum Race {
371397
AWOKEN("Awoken"),
372398
EXO("Exo"),

0 commit comments

Comments
 (0)