mirror of
https://github.com/elyby/mojang-api.git
synced 2024-11-23 05:33:10 +05:30
Implemented Reset Skin endpoint
This commit is contained in:
parent
46c0215add
commit
7ba4472ec1
@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- [UUID to Name history](https://wiki.vg/Mojang_API#UUID_-.3E_Name_history) endpoint.
|
||||
- [Playernames -> UUIDs](https://wiki.vg/Mojang_API#Playernames_-.3E_UUIDs) endpoint.
|
||||
- [Change Skin](https://wiki.vg/Mojang_API#Change_Skin) endpoint.
|
||||
- [Reset Skin](https://wiki.vg/Mojang_API#Reset_Skin) endpoint.
|
||||
|
||||
### Changed
|
||||
- The constructor no longer has arguments.
|
||||
|
17
src/Api.php
17
src/Api.php
@ -229,6 +229,23 @@ class Api {
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $accessToken
|
||||
* @param string $accountUuid
|
||||
*
|
||||
* @throws \Ely\Mojang\Exception\MojangApiException
|
||||
* @throws GuzzleException
|
||||
*
|
||||
* @url https://wiki.vg/Mojang_API#Reset_Skin
|
||||
*/
|
||||
public function resetSkin(string $accessToken, string $accountUuid): void {
|
||||
$this->getClient()->request('DELETE', "https://api.mojang.com/user/profile/{$accountUuid}/skin", [
|
||||
'headers' => [
|
||||
'Authorization' => 'Bearer ' . $accessToken,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $login
|
||||
* @param string $password
|
||||
|
@ -290,6 +290,15 @@ class ApiTest extends TestCase {
|
||||
$this->assertStringContainsString('slim', $request->getBody()->getContents());
|
||||
}
|
||||
|
||||
public function testResetSkin() {
|
||||
$this->mockHandler->append(new Response(200));
|
||||
$this->api->resetSkin('mocked access token', '86f6e3695b764412a29820cac1d4d0d6');
|
||||
/** @var \Psr\Http\Message\RequestInterface $request */
|
||||
$request = $this->history[0]['request'];
|
||||
$this->assertSame('https://api.mojang.com/user/profile/86f6e3695b764412a29820cac1d4d0d6/skin', (string)$request->getUri());
|
||||
$this->assertSame('Bearer mocked access token', $request->getHeaderLine('Authorization'));
|
||||
}
|
||||
|
||||
public function testPlayernamesToUuidsInvalidArgumentException() {
|
||||
$names = [];
|
||||
for ($i = 0; $i < 101; $i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user