Skip to content

Commit 105ef55

Browse files
committed
feat: rc
1 parent 6956bac commit 105ef55

File tree

6 files changed

+70
-1
lines changed

6 files changed

+70
-1
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,18 @@ To load the library you can use the following code:
1010
require_once WCF_DIR.'lib/system/api/nitrapi-php/autoload.php';
1111
```
1212

13+
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".
14+
15+
```PHP
16+
use wcf\util\Nitrapi;
17+
18+
try {
19+
$api = Nitrapi();
20+
var_dump($api->getServices());
21+
} catch(\Exception $e) {
22+
var_dump("API Error: " . $e->getMessage());
23+
}
24+
```
25+
1326
Everything else about NitrAPI-PHP can be found in the corresponding GitHub repository at the following URL:
1427
https://github.com/nitrado/NitrAPI-PHP
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
namespace wcf\util;
3+
4+
require_once WCF_DIR . 'lib/system/api/nitrapi-php/autoload.php';
5+
6+
class Nitrapi extends \Nitrapi\Nitrapi
7+
{
8+
public function __construct($options = array(), $url = NITRAPI_LIVE_URL)
9+
{
10+
parent::__construct(NITRAPI_ACCESS_TOKEN, $options, $url);
11+
}
12+
}

language/de.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
3+
4+
<category name="wcf.acp.option">
5+
<item name="wcf.acp.option.category.nitrapi"><![CDATA[NitrAPI]]></item>
6+
7+
<item name="wcf.acp.option.nitrapi_access_token"><![CDATA[Langzeit Token]]></item>
8+
<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>
9+
</category>
10+
11+
</language>

language/en.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
3+
4+
<category name="wcf.acp.option">
5+
<item name="wcf.acp.option.category.nitrapi"><![CDATA[NitrAPI]]></item>
6+
7+
<item name="wcf.acp.option.nitrapi_access_token"><![CDATA[Long Term Token]]></item>
8+
<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>
9+
</category>
10+
11+
</language>

option.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
3+
<import>
4+
<categories>
5+
<category name="nitrapi">
6+
<parent>general.system</parent>
7+
<showorder>101</showorder>
8+
</category>
9+
</categories>
10+
11+
<options>
12+
<option name="nitrapi_access_token">
13+
<categoryname>nitrapi</categoryname>
14+
<showorder>1</showorder>
15+
<optiontype>text</optiontype>
16+
</option>
17+
</options>
18+
</import>
19+
20+
</data>

package.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<packagename language="de"><![CDATA["NitrAPI-PHP"-Bibliothek]]></packagename>
66
<packagedescription><![CDATA[Provides the "NitrAPI-PHP" library at the WSC.]]></packagedescription>
77
<packagedescription language="de"><![CDATA[Stellt die "NitrAPI-PHP"-Bibliothek im WSC zur Verfügung.]]></packagedescription>
8-
<version>3.1</version>
8+
<version>3.1.0</version>
99
<date>2021-01-05</date>
1010
</packageinformation>
1111

@@ -24,5 +24,7 @@
2424

2525
<instructions type="install">
2626
<instruction type="file"/>
27+
<instruction type="language"/>
28+
<instruction type="option"/>
2729
</instructions>
2830
</package>

0 commit comments

Comments
 (0)