Updated APIv5 (markdown)

Risto Lahtela 2019-04-10 17:16:48 +03:00
parent 0df4dfd2ad
commit 82b1e94037

@ -11,6 +11,68 @@ API module Version | Plan Version
-- | --
0.0.3 | 4.8.0
## Checking if some part of an API is available
> This section is about API v0.0.4 which is set for release with 4.8.2
<details>
<summary>API module dependency information</summary>
Plan API is distributed via Bintray repository:
```
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>bintray-rsl1122-Plan-repository</id>
<name>bintray</name>
<url>https://dl.bintray.com/rsl1122/Plan-repository</url>
</repository>
```
```
<dependency>
<groupId>com.djrapitops</groupId>
<artifactId>Plan-api</artifactId>
<version>...</version>
</dependency>
```
Dependency version information can be found here:
https://bintray.com/rsl1122/Plan-repository/Plan-API
Remember to add `"Plan"` as a softdependency to your plugin information (plugin.yml / Plugin annotation).
</details>
<details>
<summary>Checking if the API supports a capability</summary>
- `CapabilityService` allows you to ensure that Plan version on the server has all the API capabilities you need available.
- All Plan API related things should be done in it's own class to avoid NoClassDefFoundError if Plan is not installed. Below is an example of a capability check.
```
class ClassWhereYouDoAllPlanThings {
public boolean areAllCapabilitiesAvailable() {
try {
CapabilityService capabilities = CapabilityService.getInstance();
return capabilities.hasCapability("DATA_EXTENSION_VALUES") && ...;
} catch (NoClassDefFoundError e) {
return false;
}
}
public void doOtherPlanThings() {...}
}
```
- Capability names can be found in `com.djrapitops.plan.capability.Capability` enum. Please note that this class is package private to avoid direct calls that might lead to NoSuchFieldError.
- The required capabilities are listed in the documentations below.
</details>
## DataExtension API
- [Documentation for DataExtension API](https://github.com/plan-player-analytics/Plan/wiki/APIv5---DataExtension-API)