Skip to content

Commit

Permalink
Formalise private API endpoints.
Browse files Browse the repository at this point in the history
  • Loading branch information
vekien committed Apr 17, 2019
1 parent 5897e91 commit 9f741e9
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 11 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,5 @@ $api->pvpteam->get($id, $data = []);
$api->pvpteam->update($id);
$api->pvpteam->delete($id);
```

> Note: The `_private` API is for internal use within XIVAPI and MogBoard. It cannot be used publicly and is locked behind an access key.
11 changes: 0 additions & 11 deletions src/XIVAPI/Api/Market.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,4 @@ public function categories()
{
return Guzzle::get("/market/categories");
}

public function manualUpdateItem(string $accessKey, int $itemId, int $server)
{
return Guzzle::get("/private/market/item/update", [
RequestOptions::QUERY => [
'access' => $accessKey,
'item_id' => $itemId,
'server' => $server,
]
]);
}
}
51 changes: 51 additions & 0 deletions src/XIVAPI/Api/PrivateApi.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

namespace XIVAPI\Api;

use GuzzleHttp\RequestOptions;
use XIVAPI\Guzzle\Guzzle;

class PrivateApi
{
/**
* Request an item to be updated
*/
public function manualItemUpdate(string $accessKey, int $itemId, string $server)
{
return Guzzle::get("/private/market/item/update", [
RequestOptions::QUERY => [
'companion_access_key' => $accessKey,
'item_id' => $itemId,
'server' => $server,
]
]);
}

/**
* Request an item to be updated
*/
public function itemPrices(string $accessKey, int $itemId, string $server)
{
return Guzzle::get("/private/market/item", [
RequestOptions::QUERY => [
'companion_access_key' => $accessKey,
'item_id' => $itemId,
'server' => $server,
]
]);
}

/**
* Request an item to be updated
*/
public function itemHistory(string $accessKey, int $itemId, string $server)
{
return Guzzle::get("/private/market/item/history", [
RequestOptions::QUERY => [
'companion_access_key' => $accessKey,
'item_id' => $itemId,
'server' => $server,
]
]);
}
}
4 changes: 4 additions & 0 deletions src/XIVAPI/XIVAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use XIVAPI\Api\Lodestone;
use XIVAPI\Api\Market;
use XIVAPI\Api\PatchList;
use XIVAPI\Api\PrivateApi;
use XIVAPI\Api\PvPTeam;
use XIVAPI\Api\Search;
use XIVAPI\Api\Content;
Expand Down Expand Up @@ -44,6 +45,8 @@ class XIVAPI
public $market;
/** @var PatchList */
public $patchlist;
/** @var PrivateApi */
public $_private;

public function __construct(string $environment = self::PROD)
{
Expand All @@ -61,6 +64,7 @@ public function __construct(string $environment = self::PROD)
$this->lodestone = new Lodestone();
$this->market = new Market();
$this->patchlist = new PatchList();
$this->_private = new PrivateApi();
}

public function reset(): XIVAPI
Expand Down

0 comments on commit 9f741e9

Please sign in to comment.