Skip to content

Commit

Permalink
📝 Update Docs and ReadMe
Browse files Browse the repository at this point in the history
  • Loading branch information
cadox8 committed Aug 7, 2018
1 parent 7a2c8a5 commit 3035f0c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ or send hash in format: ``username:hash`` , where hash is result authenticate ac

```java
XenAPI api = new XenAPI("YOUR_API_KEY"); // Setted in api.php
api.setBaseURL("YOUR_FORUM_URL"); // Must be http(s)://link.extension or http(s)://ip

XenAPI api = new XenAPI("YOUR_API_KEY", "YOUR_FORUM_URL"); // Setted in api.php / Must have http:// | https://
```

Then, you will use that Key in the program.
Expand Down
27 changes: 12 additions & 15 deletions docs/java-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ First, you must have the new API Key setted in api.php and the file in Xenforo r

In a new program, you have to instance the XenAPI class like this:
```java
XenAPI api = new XenAPI("YOUR_API_KEY"); //I recomend to have a [Version 4 UUID](http://uuidgenerator.net) as the Key
api.setBaseURL("YOUR_FORUM_URL"); //Must have http:// | https://
XenAPI api = new XenAPI("YOUR_API_KEY"); //I recomend to have a [Version 4 UUID](http://uuidgenerator.net) as the Key / Forum url will be localhost

XenAPI api = new XenAPI("YOUR_API_KEY", "YOUR_FORUM_URL"); //I recomend to have a [Version 4 UUID](http://uuidgenerator.net) as the Key / Must have http:// | https://
```

With this, you will be able to send Requests and get the Reply 💃.
Expand All @@ -58,19 +59,15 @@ But XenAPI has some classes to get the Reply. In this case, you will need to use
This is a example of how to get the reply (for > Java 1.8) and how to handle if we have an error code:

```java
api.getReply(r, (Callback<AuthenticateReply>) (failCause, result)-> {
try {
result.checkError();

if (failCause != null) {
failCause.printStackTrace();
} else {
System.out.println("Result: " + result.getHash());
}
} catch (ArgsErrorException e) {
e.printStackTrace();
}
});
api.getReply(r, (Callback<AuthenticateReply>) (failCause, result) -> {
try {
result.checkError();
if (failCause != null) failCause.printStackTrace();
System.out.println("Result: " + result.toString());
} catch (ArgsErrorException e) {
e.printStackTrace();
}
});
```

As you can see, we have ``Callback<AuthenticateReply>`` which allows you to use the methods of these class. You will need to change the class between the ``< >`` when you change your RequestType.

0 comments on commit 3035f0c

Please sign in to comment.