Skip to content

Commit ba6e00d

Browse files
committed
Drop support for v4 endpoints
The Kraken v4 endpoints are publically accessible but are not documented and never were. I don't see the need to include them in this implementation.
1 parent 1b8bbff commit ba6e00d

12 files changed

+92
-113
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# twitch-api-php
22

3-
A Twitch API client for PHP.
3+
A Twitch Kraken API client for PHP.
44

55
[![Build Status](https://travis-ci.org/nicklaw5/twitch-api-php.svg?branch=master)](https://travis-ci.org/nicklaw5/twitch-api-php)
66

77
## Supported APIs
88

9-
This library aims to support `v3`, `v4` and `v5` of the Twitch API until each one becomes [deprecated](https://dev.twitch.tv/docs#which-api-version-can-you-use). If an API version is not specified, `v5` will be used as the default.
9+
This library aims to support `v3` and `v5` of the Twitch API until each one becomes [deprecated](https://dev.twitch.tv/docs/v5). If an API version is not specified, `v5` will be used as the default.
1010

1111
## Features Completed
1212

examples/users/get_user_example.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
## Get User
1+
# Get User
22

3-
#### Supported API Versions
4-
v3, v4 & v5
3+
## Supported API Versions
4+
5+
v3 & v5
6+
7+
### v3 Example
58

6-
#### v3 & v4 Example
79
```php
810
$options = [
911
'client_id' => 'YOUR-CLIENT-ID',
10-
'api_version' => 3, // or 4
12+
'api_version' => 3,
1113
];
1214

1315
$twitchApi = new \TwitchApi\TwitchApi($options);
1416
$user = $twitchApi->getUser('summit1g');
1517
```
1618

17-
#### v5 Example
19+
### v5 Example
20+
1821
```php
1922
$options = [
2023
'client_id' => 'YOUR-CLIENT-ID',

src/Api/Bits.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ trait Bits
1717
*/
1818
public function getCheermotes($channelIdentifier = null)
1919
{
20-
if (!$this->apiVersionIsGreaterThanV4()) {
20+
if (!$this->apiVersionIsGreaterThanV3()) {
2121
throw new EndpointNotSupportedByApiVersionException();
2222
}
2323

src/Api/ChannelFeed.php

+11-11
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ trait ChannelFeed
2323
*/
2424
public function getMultipleFeedPosts($channelIdentifier, $accessToken, $limit = 10, $cursor = null, $comments = 5)
2525
{
26-
if ($this->apiVersionIsGreaterThanV4() && !is_numeric($channelIdentifier)) {
26+
if ($this->apiVersionIsGreaterThanV3() && !is_numeric($channelIdentifier)) {
2727
throw new InvalidIdentifierException('channel');
2828
}
2929

@@ -61,7 +61,7 @@ public function getMultipleFeedPosts($channelIdentifier, $accessToken, $limit =
6161
*/
6262
public function getFeedPost($channelIdentifier, $postId, $accessToken, $comments = 5)
6363
{
64-
if ($this->apiVersionIsGreaterThanV4() && !is_numeric($channelIdentifier)) {
64+
if ($this->apiVersionIsGreaterThanV3() && !is_numeric($channelIdentifier)) {
6565
throw new InvalidIdentifierException('channel');
6666
}
6767

@@ -93,7 +93,7 @@ public function getFeedPost($channelIdentifier, $postId, $accessToken, $comments
9393
*/
9494
public function createFeedPost($channelIdentifier, $accessToken, $content, $share = false)
9595
{
96-
if ($this->apiVersionIsGreaterThanV4() && !is_numeric($channelIdentifier)) {
96+
if ($this->apiVersionIsGreaterThanV3() && !is_numeric($channelIdentifier)) {
9797
throw new InvalidIdentifierException('channel');
9898
}
9999

@@ -125,7 +125,7 @@ public function createFeedPost($channelIdentifier, $accessToken, $content, $shar
125125
*/
126126
public function deleteFeedPost($channelIdentifier, $postId, $accessToken)
127127
{
128-
if ($this->apiVersionIsGreaterThanV4() && !is_numeric($channelIdentifier)) {
128+
if ($this->apiVersionIsGreaterThanV3() && !is_numeric($channelIdentifier)) {
129129
throw new InvalidIdentifierException('channel');
130130
}
131131

@@ -149,7 +149,7 @@ public function deleteFeedPost($channelIdentifier, $postId, $accessToken)
149149
*/
150150
public function createFeedPostReaction($channelIdentifier, $postId, $accessToken, $emoteId)
151151
{
152-
if ($this->apiVersionIsGreaterThanV4() && !is_numeric($channelIdentifier)) {
152+
if ($this->apiVersionIsGreaterThanV3() && !is_numeric($channelIdentifier)) {
153153
throw new InvalidIdentifierException('channel');
154154
}
155155

@@ -181,7 +181,7 @@ public function createFeedPostReaction($channelIdentifier, $postId, $accessToken
181181
*/
182182
public function deleteFeedPostReaction($channelIdentifier, $postId, $accessToken, $emoteId)
183183
{
184-
if ($this->apiVersionIsGreaterThanV4() && !is_numeric($channelIdentifier)) {
184+
if ($this->apiVersionIsGreaterThanV3() && !is_numeric($channelIdentifier)) {
185185
throw new InvalidIdentifierException('channel');
186186
}
187187

@@ -215,7 +215,7 @@ public function deleteFeedPostReaction($channelIdentifier, $postId, $accessToken
215215
*/
216216
public function getFeedComments($channelIdentifier, $postId, $accessToken, $limit = 10, $cursor = null)
217217
{
218-
if ($this->apiVersionIsGreaterThanV4() && !is_numeric($channelIdentifier)) {
218+
if ($this->apiVersionIsGreaterThanV3() && !is_numeric($channelIdentifier)) {
219219
throw new InvalidIdentifierException('channel');
220220
}
221221

@@ -252,7 +252,7 @@ public function getFeedComments($channelIdentifier, $postId, $accessToken, $limi
252252
*/
253253
public function createFeedComment($channelIdentifier, $postId, $accessToken, $comment)
254254
{
255-
if ($this->apiVersionIsGreaterThanV4() && !is_numeric($channelIdentifier)) {
255+
if ($this->apiVersionIsGreaterThanV3() && !is_numeric($channelIdentifier)) {
256256
throw new InvalidIdentifierException('channel');
257257
}
258258

@@ -280,7 +280,7 @@ public function createFeedComment($channelIdentifier, $postId, $accessToken, $co
280280
*/
281281
public function deleteFeedComment($channelIdentifier, $postId, $commentId, $accessToken)
282282
{
283-
if ($this->apiVersionIsGreaterThanV4() && !is_numeric($channelIdentifier)) {
283+
if ($this->apiVersionIsGreaterThanV3() && !is_numeric($channelIdentifier)) {
284284
throw new InvalidIdentifierException('channel');
285285
}
286286

@@ -301,7 +301,7 @@ public function deleteFeedComment($channelIdentifier, $postId, $commentId, $acce
301301
*/
302302
public function createFeedCommentReaction($channelIdentifier, $postId, $commentId, $accessToken, $emoteId)
303303
{
304-
if ($this->apiVersionIsGreaterThanV4() && !is_numeric($channelIdentifier)) {
304+
if ($this->apiVersionIsGreaterThanV3() && !is_numeric($channelIdentifier)) {
305305
throw new InvalidIdentifierException('channel');
306306
}
307307

@@ -334,7 +334,7 @@ public function createFeedCommentReaction($channelIdentifier, $postId, $commentI
334334
*/
335335
public function deleteFeedCommentReaction($channelIdentifier, $postId, $commentId, $accessToken, $emoteId)
336336
{
337-
if ($this->apiVersionIsGreaterThanV4() && !is_numeric($channelIdentifier)) {
337+
if ($this->apiVersionIsGreaterThanV3() && !is_numeric($channelIdentifier)) {
338338
throw new InvalidIdentifierException('channel');
339339
}
340340

src/Api/Channels.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function getAuthenticatedChannel($accessToken)
3333
*/
3434
public function getChannel($channelIdentifier)
3535
{
36-
if ($this->apiVersionIsGreaterThanV4() && !is_numeric($channelIdentifier)) {
36+
if ($this->apiVersionIsGreaterThanV3() && !is_numeric($channelIdentifier)) {
3737
throw new InvalidIdentifierException('channel');
3838
}
3939

@@ -59,7 +59,7 @@ public function updateChannel($channelIdentifier, $accessToken, $status = null,
5959
$params = [];
6060
$params['channel'] = [];
6161

62-
if ($this->apiVersionIsGreaterThanV4() && !is_numeric($channelIdentifier)) {
62+
if ($this->apiVersionIsGreaterThanV3() && !is_numeric($channelIdentifier)) {
6363
throw new InvalidIdentifierException('channel');
6464
}
6565

@@ -108,7 +108,7 @@ public function updateChannel($channelIdentifier, $accessToken, $status = null,
108108
*/
109109
public function getChannelEditors($channelIdentifier, $accessToken)
110110
{
111-
if ($this->apiVersionIsGreaterThanV4() && !is_numeric($channelIdentifier)) {
111+
if ($this->apiVersionIsGreaterThanV3() && !is_numeric($channelIdentifier)) {
112112
throw new InvalidIdentifierException('channel');
113113
}
114114

@@ -132,7 +132,7 @@ public function getChannelEditors($channelIdentifier, $accessToken)
132132
*/
133133
public function getChannelFollowers($channelIdentifier, $limit = 25, $offset = 0, $cursor = null, $direction = 'desc')
134134
{
135-
if ($this->apiVersionIsGreaterThanV4() && !is_numeric($channelIdentifier)) {
135+
if ($this->apiVersionIsGreaterThanV3() && !is_numeric($channelIdentifier)) {
136136
throw new InvalidIdentifierException('channel');
137137
}
138138

@@ -171,7 +171,7 @@ public function getChannelFollowers($channelIdentifier, $limit = 25, $offset = 0
171171
*/
172172
public function getChannelTeams($channelIdentifier)
173173
{
174-
if ($this->apiVersionIsGreaterThanV4() && !is_numeric($channelIdentifier)) {
174+
if ($this->apiVersionIsGreaterThanV3() && !is_numeric($channelIdentifier)) {
175175
throw new InvalidIdentifierException('channel');
176176
}
177177

@@ -194,7 +194,7 @@ public function getChannelTeams($channelIdentifier)
194194
*/
195195
public function getChannelSubscribers($channelIdentifier, $accessToken, $limit = 25, $offset = 0, $direction = 'desc')
196196
{
197-
if ($this->apiVersionIsGreaterThanV4() && !is_numeric($channelIdentifier)) {
197+
if ($this->apiVersionIsGreaterThanV3() && !is_numeric($channelIdentifier)) {
198198
throw new InvalidIdentifierException('channel');
199199
}
200200

@@ -230,7 +230,7 @@ public function getChannelSubscribers($channelIdentifier, $accessToken, $limit =
230230
*/
231231
public function checkChannelSubscriptionByUser($channelIdentifier, $userIdentifier, $accessToken)
232232
{
233-
if ($this->apiVersionIsGreaterThanV4()) {
233+
if ($this->apiVersionIsGreaterThanV3()) {
234234
if (!is_numeric($channelIdentifier)) {
235235
throw new InvalidIdentifierException('channel');
236236
}
@@ -263,7 +263,7 @@ public function getChannelVideos($channelIdentifier, $limit = 10, $offset = 0, $
263263
{
264264
$validSort = ['views', 'time'];
265265

266-
if ($this->apiVersionIsGreaterThanV4() && !is_numeric($channelIdentifier)) {
266+
if ($this->apiVersionIsGreaterThanV3() && !is_numeric($channelIdentifier)) {
267267
throw new InvalidIdentifierException('channel');
268268
}
269269

@@ -313,7 +313,7 @@ public function startChannelCommercial($channelIdentifier, $accessToken, $length
313313
{
314314
$validLengths = [30, 60, 90, 120, 150, 180];
315315

316-
if ($this->apiVersionIsGreaterThanV4() && !is_numeric($channelIdentifier)) {
316+
if ($this->apiVersionIsGreaterThanV3() && !is_numeric($channelIdentifier)) {
317317
throw new InvalidIdentifierException('channel');
318318
}
319319

@@ -334,7 +334,7 @@ public function startChannelCommercial($channelIdentifier, $accessToken, $length
334334
*/
335335
public function resetChannelStreamKey($channelIdentifier, $accessToken)
336336
{
337-
if ($this->apiVersionIsGreaterThanV4() && !is_numeric($channelIdentifier)) {
337+
if ($this->apiVersionIsGreaterThanV3() && !is_numeric($channelIdentifier)) {
338338
throw new InvalidIdentifierException('channel');
339339
}
340340

@@ -351,7 +351,7 @@ public function resetChannelStreamKey($channelIdentifier, $accessToken)
351351
*/
352352
public function getChannelCommunity($channelIdentifier)
353353
{
354-
if (!$this->apiVersionIsGreaterThanV4()) {
354+
if (!$this->apiVersionIsGreaterThanV3()) {
355355
throw new EndpointNotSupportedByApiVersionException();
356356
}
357357

@@ -374,7 +374,7 @@ public function getChannelCommunity($channelIdentifier)
374374
*/
375375
public function setChannelCommunity($channelIdentifier, $communityId, $accessToken)
376376
{
377-
if (!$this->apiVersionIsGreaterThanV4()) {
377+
if (!$this->apiVersionIsGreaterThanV3()) {
378378
throw new EndpointNotSupportedByApiVersionException();
379379
}
380380

@@ -396,7 +396,7 @@ public function setChannelCommunity($channelIdentifier, $communityId, $accessTok
396396
*/
397397
public function deleteChannelFromCommunity($channelIdentifier, $accessToken)
398398
{
399-
if (!$this->apiVersionIsGreaterThanV4()) {
399+
if (!$this->apiVersionIsGreaterThanV3()) {
400400
throw new EndpointNotSupportedByApiVersionException();
401401
}
402402

src/Api/Chat.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ trait Chat
1616
*/
1717
public function getChannelChatBadges($channelIdentifier)
1818
{
19-
if ($this->apiVersionIsGreaterThanV4() && !is_numeric($channelIdentifier)) {
19+
if ($this->apiVersionIsGreaterThanV3() && !is_numeric($channelIdentifier)) {
2020
throw new InvalidIdentifierException('channel');
2121
}
2222

src/Api/Collections.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ trait Collections
1919
*/
2020
public function getCollectionMetadata($collectionId)
2121
{
22-
if (!$this->apiVersionIsGreaterThanV4()) {
22+
if (!$this->apiVersionIsGreaterThanV3()) {
2323
throw new EndpointNotSupportedByApiVersionException();
2424
}
2525

@@ -37,7 +37,7 @@ public function getCollectionMetadata($collectionId)
3737
*/
3838
public function getCollection($collectionId, $includeAllItems = false)
3939
{
40-
if (!$this->apiVersionIsGreaterThanV4()) {
40+
if (!$this->apiVersionIsGreaterThanV3()) {
4141
throw new EndpointNotSupportedByApiVersionException();
4242
}
4343

@@ -67,7 +67,7 @@ public function getCollection($collectionId, $includeAllItems = false)
6767
*/
6868
public function getChannelCollection($channelIdentifier, $limit = 10, $cursor = null, $containingItem = null)
6969
{
70-
if (!$this->apiVersionIsGreaterThanV4()) {
70+
if (!$this->apiVersionIsGreaterThanV3()) {
7171
throw new EndpointNotSupportedByApiVersionException();
7272
}
7373

@@ -109,7 +109,7 @@ public function getChannelCollection($channelIdentifier, $limit = 10, $cursor =
109109
*/
110110
public function createCollection($channelIdentifier, $title, $accessToken)
111111
{
112-
if (!$this->apiVersionIsGreaterThanV4()) {
112+
if (!$this->apiVersionIsGreaterThanV3()) {
113113
throw new EndpointNotSupportedByApiVersionException();
114114
}
115115

@@ -140,7 +140,7 @@ public function createCollection($channelIdentifier, $title, $accessToken)
140140
*/
141141
public function updateCollection($collectionId, $title, $accessToken)
142142
{
143-
if (!$this->apiVersionIsGreaterThanV4()) {
143+
if (!$this->apiVersionIsGreaterThanV3()) {
144144
throw new EndpointNotSupportedByApiVersionException();
145145
}
146146

@@ -166,7 +166,7 @@ public function updateCollection($collectionId, $title, $accessToken)
166166
*/
167167
public function createCollectionThumbnail($collectionId, $itemId, $accessToken)
168168
{
169-
if (!$this->apiVersionIsGreaterThanV4()) {
169+
if (!$this->apiVersionIsGreaterThanV3()) {
170170
throw new EndpointNotSupportedByApiVersionException();
171171
}
172172

@@ -192,7 +192,7 @@ public function createCollectionThumbnail($collectionId, $itemId, $accessToken)
192192
*/
193193
public function deleteCollection($collectionId, $accessToken)
194194
{
195-
if (!$this->apiVersionIsGreaterThanV4()) {
195+
if (!$this->apiVersionIsGreaterThanV3()) {
196196
throw new EndpointNotSupportedByApiVersionException();
197197
}
198198

@@ -212,7 +212,7 @@ public function deleteCollection($collectionId, $accessToken)
212212
*/
213213
public function addCollectionItem($collectionId, $itemId, $itemType = 'video', $accessToken)
214214
{
215-
if (!$this->apiVersionIsGreaterThanV4()) {
215+
if (!$this->apiVersionIsGreaterThanV3()) {
216216
throw new EndpointNotSupportedByApiVersionException();
217217
}
218218

@@ -244,7 +244,7 @@ public function addCollectionItem($collectionId, $itemId, $itemType = 'video', $
244244
*/
245245
public function deleteCollectionItem($collectionId, $itemId, $accessToken)
246246
{
247-
if (!$this->apiVersionIsGreaterThanV4()) {
247+
if (!$this->apiVersionIsGreaterThanV3()) {
248248
throw new EndpointNotSupportedByApiVersionException();
249249
}
250250

@@ -269,7 +269,7 @@ public function deleteCollectionItem($collectionId, $itemId, $accessToken)
269269
*/
270270
public function moveCollectionThumbnail($collectionId, $itemId, $position, $accessToken)
271271
{
272-
if (!$this->apiVersionIsGreaterThanV4()) {
272+
if (!$this->apiVersionIsGreaterThanV3()) {
273273
throw new EndpointNotSupportedByApiVersionException();
274274
}
275275

0 commit comments

Comments
 (0)