eihmels/twitch-helix-streams
实现了 Twitch Api 的 "GET https://api.twitch.tv/helix/streams"
1.1.0
2023-08-27 10:32 UTC
Requires
- php: ^8.1
- beberlei/assert: ^3.3
- guzzlehttp/guzzle: ^7.5
Requires (Dev)
- ext-http: *
- mockery/mockery: ^1.5
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^9
- rector/rector: ^0.15.11
- slevomat/coding-standard: ^8.8
- squizlabs/php_codesniffer: ^3.7
This package is auto-updated.
Last update: 2024-09-27 12:54:28 UTC
README
twitch-helix-streams
实现了 Twitch Api 的 "GET https://api.twitch.tv/helix/streams"
您可以在此处找到此 Api 的完整文档。
要求
>= PHP 8.1
开始使用
Composer Require
composer require eihmels/twitch-helix-streams
请查看示例文件夹,更改您的凭证并尝试。
您将得到一个从 GetStreams 类生成的 StreamCollection,看起来像这样
StreamCollection:
Streams[] streams;
Pagination pagination
流
单个流的表示,包含来自 Api 的所有信息。看起来像这样
Stream:
StreamIdentifier streamIdentifier,
UserIdentifier userIdentifier,
UserLogin userLogin,
UserName userName,
Type type,
Title title,
Tags tags,
ViewerCount viewerCount,
StartedAt startedAt,
Language language,
ThumbnailUrl thumbnailUrl,
TagIdentifiers tagIdentifiers,
IsMature isMature
请参考Twitch 流文档了解此内容。
客户端
您必须初始化一个客户端,该客户端包含端点、您的 ClientId 和一个 ClientInterface。
$client = new TwitchHelix('https://api.twitch.tv', '/helix/streams', '<yourClientId>', new Client());
现在您可以使用 Application 初始化,它返回一个与上面类似的流列表
$application->execute( '<yourToken>', new QueryParameterCollection( [ new UserIdentifier('123456') ], new First(2), ) ));
查询
您可以使用 QueryParameterCollection 中的查询参数来查询流
可用的查询参数
- 语言
- 游戏标识符
- 用户标识符
- 用户登录名
- 类型