Skip to content

Commit

Permalink
feat: rc
Browse files Browse the repository at this point in the history
  • Loading branch information
TitusKirch committed Jan 5, 2021
1 parent 6956bac commit 105ef55
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 1 deletion.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,18 @@ To load the library you can use the following code:
require_once WCF_DIR.'lib/system/api/nitrapi-php/autoload.php';
```

Or use the supplied Util class for the WSC.Note that here the access token is set by the user via the option "Long Term Token".

```PHP
use wcf\util\Nitrapi;

try {
$api = Nitrapi();
var_dump($api->getServices());
} catch(\Exception $e) {
var_dump("API Error: " . $e->getMessage());
}
```

Everything else about NitrAPI-PHP can be found in the corresponding GitHub repository at the following URL:
https://github.com/nitrado/NitrAPI-PHP
12 changes: 12 additions & 0 deletions files/lib/system/util/Nitrapi.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
namespace wcf\util;

require_once WCF_DIR . 'lib/system/api/nitrapi-php/autoload.php';

class Nitrapi extends \Nitrapi\Nitrapi
{
public function __construct($options = array(), $url = NITRAPI_LIVE_URL)
{
parent::__construct(NITRAPI_ACCESS_TOKEN, $options, $url);
}
}
11 changes: 11 additions & 0 deletions language/de.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<language xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com https://www.woltlab.com/XSD/tornado/language.xsd" languagecode="de">

<category name="wcf.acp.option">
<item name="wcf.acp.option.category.nitrapi"><![CDATA[NitrAPI]]></item>

<item name="wcf.acp.option.nitrapi_access_token"><![CDATA[Langzeit Token]]></item>
<item name="wcf.acp.option.nitrapi_access_token.description"><![CDATA[Langzeit Token können unter <a href="https://server.nitrado.net/deu/developer/tokens" class="externalURL" rel="noopener noreferrer" style="">https://server.nitrado.net/deu/developer/tokens</a> erstellt werden.]]></item>
</category>

</language>
11 changes: 11 additions & 0 deletions language/en.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<language xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com https://www.woltlab.com/XSD/tornado/language.xsd" languagecode="en">

<category name="wcf.acp.option">
<item name="wcf.acp.option.category.nitrapi"><![CDATA[NitrAPI]]></item>

<item name="wcf.acp.option.nitrapi_access_token"><![CDATA[Long Term Token]]></item>
<item name="wcf.acp.option.nitrapi_access_token.description"><![CDATA[Long term tokens can be created at <a href="https://server.nitrado.net/deu/developer/tokens" class="externalURL" rel="noopener noreferrer" style="">https://server.nitrado.net/deu/developer/tokens</a>]]></item>
</category>

</language>
20 changes: 20 additions & 0 deletions option.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/tornado/option.xsd">
<import>
<categories>
<category name="nitrapi">
<parent>general.system</parent>
<showorder>101</showorder>
</category>
</categories>

<options>
<option name="nitrapi_access_token">
<categoryname>nitrapi</categoryname>
<showorder>1</showorder>
<optiontype>text</optiontype>
</option>
</options>
</import>

</data>
4 changes: 3 additions & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<packagename language="de"><![CDATA["NitrAPI-PHP"-Bibliothek]]></packagename>
<packagedescription><![CDATA[Provides the "NitrAPI-PHP" library at the WSC.]]></packagedescription>
<packagedescription language="de"><![CDATA[Stellt die "NitrAPI-PHP"-Bibliothek im WSC zur Verfügung.]]></packagedescription>
<version>3.1</version>
<version>3.1.0</version>
<date>2021-01-05</date>
</packageinformation>

Expand All @@ -24,5 +24,7 @@

<instructions type="install">
<instruction type="file"/>
<instruction type="language"/>
<instruction type="option"/>
</instructions>
</package>

0 comments on commit 105ef55

Please sign in to comment.