r6api / client
Rainbow 6 Siege 统计API的客户端
1.1.0
2018-11-08 23:41 UTC
Requires
- php: >=7.1
- ext-ctype: *
- greg0ire/enum: ^4.0
- php-http/client-implementation: ^1.0
- php-http/discovery: ^1.0
- php-http/httplug: ^1.0
- php-http/message: ^1.0
- php-http/message-factory: ^v1.0
- psr/cache: ^1.0
- psr/http-message: ^1.0
- ramsey/uuid: ^3.8
- symfony/property-access: ^4.1
- symfony/serializer: ^4.1
Requires (Dev)
- cache/predis-adapter: ^1.0
- php-http/guzzle6-adapter: ^1.1
- phpunit/phpunit: ^7.3
Suggests
- php-http/curl-client: In order to use cURL as the HTTP client
- php-http/guzzle6-adapter: In order to use Guzzle v6 as the HTTP client
This package is not auto-updated.
Last update: 2024-09-16 01:23:02 UTC
README
安装
您可以通过Composer安装此库。运行以下命令
composer require r6api/client
这将安装客户端而不包含所需的HTTP客户端。我们建议您安装
php-http/curl-client
如果您项目中没有HTTP客户端,这将更简单。php-http/guzzle6-adapter
如果您已经使用guzzle,我建议您使用此包。
要使用此库,请使用Composer的自动加载
require_once __DIR__. '/vendor/autoload.php';
入门指南
获取某人资料的基本用法
require_once __DIR__.'/vendor/autoload.php'; use R6API\Client\ClientBuilder; use R6API\Client\Api\Type\PlatformType; $builder = new ClientBuilder(); $builder->setCacheItemPool($cacheItemPool); // accept PSR-6 adapter (not mandatory) $client = $builder->buildAuthenticated('%email%', '%password%');
文档
资料
查找名为 panda_______
的用户资料
$profiles = $client->getProfileApi()->get(PlatformType::PC, 'panda_______');
$profiles
将包含一个包含 Profile
模型的数组
class Profile { /** * @var \Ramsey\Uuid\Uuid */ public $profileId; /** * @var \Ramsey\Uuid\Uuid */ public $userId; /** * @var string * @see \R6API\Client\Api\Type\PlatformType */ public $platformType; /** * @var \Ramsey\Uuid\Uuid */ public $idOnPlatform; /** * @var string */ public $nameOnPlatform; }
进展
在资料示例中搜索用户的进展
$progressions = $client->getProgressionApi()->get(PlatformType::PC, ['575b8c76-a33a-4c19-9618-d14b9343d527']);
$progressions
将包含一个包含 Progression
模型的数组
class Progression { /** * @var int */ public $xp; /** * @var Uuid */ public $profileId; /** * @var int */ public $lootboxProbability; /** * @var int */ public $level; public function getLootboxProbabilityPercent(): float; }
排名
在资料示例中搜索用户的排名
$response = $client->getRankApi()->get(PlatformType::PC, RegionType::EUROPE, SeasonType::CURRENT, ['575b8c76-a33a-4c19-9618-d14b9343d527']);
$response
将包含一个包含 Rank
模型的数组
class Rank { /** * @var string */ public $boardId; /** * @var int */ public $pastSeasonsAbandons; /** * @var \DateTime */ public $updateTime; /** * @var float */ public $skillMean; /** * @var int */ public $abandons; /** * @var int */ public $season; /** * @var string */ public $region; /** * @var Uuid */ public $profileId; /** * @var int */ public $pastSeasonsLosses; /** * @var float */ public $maxMmr; /** * @var float */ public $mmr; /** * @var int */ public $wins; /** * @var float */ public $skillStdev; /** * @var int */ public $rank; /** * @var int */ public $losses; /** * @var int */ public $nextRankMmr; /** * @var int */ public $pastSeasonsWins; /** * @var int */ public $previousRankMmr; /** * @var int */ public $maxRank; public function getWinLosseRate(): float; }
统计信息
在资料示例中搜索用户的统计信息
$statistics = [ StatisticType::CASUAL_TIMEPLAYED, StatisticType::CASUAL_MATCHPLAYED, StatisticType::CASUAL_MATCHWON, StatisticType::CASUAL_MATCHLOSTS, StatisticType::CASUAL_KILLS, StatisticType::CASUAL_DEATH ]; $response = $client->getStatisticApi()->get(PlatformType::PC, ['575b8c76-a33a-4c19-9618-d14b9343d527'], $statistics);
$response
将包含一个包含 Statistic
模型的数组
class Statistic
{
/**
* @var Uuid
*/
public $profileId;
/**
* @var array
*/
public $statistics;
}
请注意,$statistics
数组将包含所有具有 StatisticType
作为键和相应值作为值的响应;)