Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

Commit 4670eb2

Browse files
committed
:octocat: Twitter: Endpoint updates (WIP, might not reflect the latest API changes)
1 parent 57a09fe commit 4670eb2

File tree

4 files changed

+716
-772
lines changed

4 files changed

+716
-772
lines changed

src/Twitter/Twitter.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* @method \Psr\Http\Message\ResponseInterface accountSettings()
2121
* @method \Psr\Http\Message\ResponseInterface accountUpdateProfile(array $body = ['name', 'url', 'location', 'description', 'profile_link_color', 'include_entities', 'skip_status'])
2222
* @method \Psr\Http\Message\ResponseInterface accountUpdateSettings(array $body = ['sleep_time_enabled', 'start_sleep_time', 'end_sleep_time', 'time_zone', 'trend_location_woeid', 'lang'])
23-
* @method \Psr\Http\Message\ResponseInterface block(array $body = ['user_id', 'screen_name', 'include_entities', 'skip_status'])
23+
* @method \Psr\Http\Message\ResponseInterface block(array $params = ['user_id', 'screen_name', 'include_entities', 'skip_status'])
2424
* @method \Psr\Http\Message\ResponseInterface blocksIds(array $params = ['cursor', 'stringify_ids'])
2525
* @method \Psr\Http\Message\ResponseInterface blocksList(array $params = ['cursor', 'include_entities', 'skip_status'])
2626
* @method \Psr\Http\Message\ResponseInterface collectionsCreate(array $body = ['name', 'description', 'url', 'timeline_order'])
@@ -38,8 +38,8 @@
3838
* @method \Psr\Http\Message\ResponseInterface directMessagesEventsDestroy(array $params = ['id'])
3939
* @method \Psr\Http\Message\ResponseInterface directMessagesEventsList(array $params = ['cursor'])
4040
* @method \Psr\Http\Message\ResponseInterface directMessagesEventsShow(array $params = ['id'])
41-
* @method \Psr\Http\Message\ResponseInterface directMessagesIndicateTyping(array $body = ['recipient_id'])
42-
* @method \Psr\Http\Message\ResponseInterface directMessagesMarkRead(array $body = ['last_read_event_id', 'recipient_id'])
41+
* @method \Psr\Http\Message\ResponseInterface directMessagesIndicateTyping(array $params = ['recipient_id'])
42+
* @method \Psr\Http\Message\ResponseInterface directMessagesMarkRead(array $params = ['last_read_event_id', 'recipient_id'])
4343
* @method \Psr\Http\Message\ResponseInterface directMessagesSent(array $params = ['since_id', 'max_id', 'count', 'page', 'trim_user', 'include_entities'])
4444
* @method \Psr\Http\Message\ResponseInterface directMessagesShow(array $params = ['id', 'trim_user', 'include_entities'])
4545
* @method \Psr\Http\Message\ResponseInterface directMessagesWelcomeMessagesDestroy(array $params = ['id'])
@@ -122,9 +122,6 @@
122122
* @method \Psr\Http\Message\ResponseInterface usersProfileBanner(array $params = ['user_id', 'screen_name'])
123123
* @method \Psr\Http\Message\ResponseInterface usersSearch(array $params = ['q', 'page', 'count', 'include_entities', 'skip_status'])
124124
* @method \Psr\Http\Message\ResponseInterface usersShow(array $params = ['user_id', 'screen_name', 'include_entities', 'skip_status'])
125-
* @method \Psr\Http\Message\ResponseInterface usersSuggestions(array $params = ['lang'])
126-
* @method \Psr\Http\Message\ResponseInterface usersSuggestionsSlug(string $slug, array $params = ['lang'])
127-
* @method \Psr\Http\Message\ResponseInterface usersSuggestionsSlugMembers(string $slug, array $params = ['lang'])
128125
* @method \Psr\Http\Message\ResponseInterface verifyCredentials(array $params = ['include_entities', 'skip_status'])
129126
*/
130127
class Twitter extends OAuth1Provider{
@@ -137,7 +134,7 @@ class Twitter extends OAuth1Provider{
137134

138135
protected string $requestTokenURL = 'https://api.twitter.com/oauth/request_token';
139136
protected string $accessTokenURL = 'https://api.twitter.com/oauth/access_token';
140-
protected ?string $apiURL = 'https://api.twitter.com/1.1';
137+
protected ?string $apiURL = 'https://api.twitter.com';
141138
protected ?string $userRevokeURL = 'https://twitter.com/settings/applications';
142139
protected ?string $endpointMap = TwitterEndpoints::class;
143140
protected ?string $apiDocs = 'https://developer.twitter.com/docs';

src/Twitter/TwitterCC.php

Lines changed: 2 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -19,125 +19,50 @@
1919
use Psr\Http\Message\UriInterface;
2020

2121
/**
22-
* @method \Psr\Http\Message\ResponseInterface accountRemoveProfileBanner()
23-
* @method \Psr\Http\Message\ResponseInterface accountSettings()
24-
* @method \Psr\Http\Message\ResponseInterface accountUpdateProfile(array $body = ['name', 'url', 'location', 'description', 'profile_link_color', 'include_entities', 'skip_status'])
25-
* @method \Psr\Http\Message\ResponseInterface accountUpdateSettings(array $body = ['sleep_time_enabled', 'start_sleep_time', 'end_sleep_time', 'time_zone', 'trend_location_woeid', 'lang'])
26-
* @method \Psr\Http\Message\ResponseInterface block(array $body = ['user_id', 'screen_name', 'include_entities', 'skip_status'])
27-
* @method \Psr\Http\Message\ResponseInterface blocksIds(array $params = ['cursor', 'stringify_ids'])
28-
* @method \Psr\Http\Message\ResponseInterface blocksList(array $params = ['cursor', 'include_entities', 'skip_status'])
29-
* @method \Psr\Http\Message\ResponseInterface collectionsCreate(array $body = ['name', 'description', 'url', 'timeline_order'])
30-
* @method \Psr\Http\Message\ResponseInterface collectionsDestroy(array $body = ['id'])
31-
* @method \Psr\Http\Message\ResponseInterface collectionsEntries(array $params = ['id', 'count', 'max_position', 'min_position'])
32-
* @method \Psr\Http\Message\ResponseInterface collectionsEntriesAdd(array $body = ['id', 'tweet_id', 'relative_to', 'above'])
33-
* @method \Psr\Http\Message\ResponseInterface collectionsEntriesCurate(array $body = ['id', 'changes'])
34-
* @method \Psr\Http\Message\ResponseInterface collectionsEntriesMove(array $body = ['id', 'tweet_id', 'relative_to', 'above'])
35-
* @method \Psr\Http\Message\ResponseInterface collectionsEntriesRemove(array $body = ['id', 'tweet_id'])
36-
* @method \Psr\Http\Message\ResponseInterface collectionsList(array $params = ['user_id', 'screen_name', 'tweet_id', 'cursor', 'count'])
37-
* @method \Psr\Http\Message\ResponseInterface collectionsShow(array $params = ['id'])
38-
* @method \Psr\Http\Message\ResponseInterface collectionsUpdate(array $body = ['id', 'name', 'description', 'url'])
39-
* @method \Psr\Http\Message\ResponseInterface directMessages(array $params = ['since_id', 'max_id', 'count', 'trim_user', 'include_entities', 'skip_status'])
40-
* @method \Psr\Http\Message\ResponseInterface directMessagesDestroy(array $body = ['id', 'include_entities'])
41-
* @method \Psr\Http\Message\ResponseInterface directMessagesEventsDestroy(array $params = ['id'])
42-
* @method \Psr\Http\Message\ResponseInterface directMessagesEventsList(array $params = ['cursor'])
43-
* @method \Psr\Http\Message\ResponseInterface directMessagesEventsShow(array $params = ['id'])
44-
* @method \Psr\Http\Message\ResponseInterface directMessagesIndicateTyping(array $body = ['recipient_id'])
45-
* @method \Psr\Http\Message\ResponseInterface directMessagesMarkRead(array $body = ['last_read_event_id', 'recipient_id'])
46-
* @method \Psr\Http\Message\ResponseInterface directMessagesSent(array $params = ['since_id', 'max_id', 'count', 'page', 'trim_user', 'include_entities'])
47-
* @method \Psr\Http\Message\ResponseInterface directMessagesShow(array $params = ['id', 'trim_user', 'include_entities'])
48-
* @method \Psr\Http\Message\ResponseInterface directMessagesWelcomeMessagesDestroy(array $params = ['id'])
49-
* @method \Psr\Http\Message\ResponseInterface directMessagesWelcomeMessagesList(array $params = ['cursor'])
50-
* @method \Psr\Http\Message\ResponseInterface directMessagesWelcomeMessagesNew(array $body = ['welcome_message'])
51-
* @method \Psr\Http\Message\ResponseInterface directMessagesWelcomeMessagesRulesDestroy(array $params = ['id'])
52-
* @method \Psr\Http\Message\ResponseInterface directMessagesWelcomeMessagesRulesList(array $params = ['cursor'])
53-
* @method \Psr\Http\Message\ResponseInterface directMessagesWelcomeMessagesRulesNew(array $body = ['welcome_message_rule'])
54-
* @method \Psr\Http\Message\ResponseInterface directMessagesWelcomeMessagesRulesShow(array $params = ['id'])
55-
* @method \Psr\Http\Message\ResponseInterface directMessagesWelcomeMessagesShow(array $params = ['id'])
56-
* @method \Psr\Http\Message\ResponseInterface directMessagesWelcomeMessagesUpdate(array $params = ['id'])
57-
* @method \Psr\Http\Message\ResponseInterface favorite(array $body = ['id', 'include_entities'])
5822
* @method \Psr\Http\Message\ResponseInterface favoritesList(array $params = ['user_id', 'screen_name', 'count', 'since_id', 'max_id', 'skip_status', 'include_entities'])
59-
* @method \Psr\Http\Message\ResponseInterface follow(array $body = ['user_id', 'screen_name', 'follow'])
6023
* @method \Psr\Http\Message\ResponseInterface followersIds(array $params = ['user_id', 'screen_name', 'stringify_ids', 'cursor', 'count'])
6124
* @method \Psr\Http\Message\ResponseInterface followersList(array $params = ['user_id', 'screen_name', 'cursor', 'count', 'include_entities', 'skip_status'])
6225
* @method \Psr\Http\Message\ResponseInterface friendsIds(array $params = ['user_id', 'screen_name', 'stringify_ids', 'cursor', 'count'])
6326
* @method \Psr\Http\Message\ResponseInterface friendsList(array $params = ['user_id', 'screen_name', 'cursor', 'count', 'include_entities', 'skip_status'])
64-
* @method \Psr\Http\Message\ResponseInterface friendshipsIncoming(array $params = ['cursor', 'stringify_ids'])
65-
* @method \Psr\Http\Message\ResponseInterface friendshipsLookup(array $params = ['user_id', 'screen_name'])
66-
* @method \Psr\Http\Message\ResponseInterface friendshipsNoRetweetsIds(array $params = ['stringify_ids'])
67-
* @method \Psr\Http\Message\ResponseInterface friendshipsOutgoing(array $params = ['cursor', 'stringify_ids'])
6827
* @method \Psr\Http\Message\ResponseInterface friendshipsShow(array $params = ['source_id', 'source_screen_name', 'target_id', 'target_screen_name'])
69-
* @method \Psr\Http\Message\ResponseInterface friendshipsUpdate(array $body = ['user_id', 'screen_name', 'device', 'retweets'])
70-
* @method \Psr\Http\Message\ResponseInterface geoPlace(string $place_id)
71-
* @method \Psr\Http\Message\ResponseInterface geoReverseGeocode(array $params = ['lat', 'long', 'accuracy', 'granularity', 'max_results'])
72-
* @method \Psr\Http\Message\ResponseInterface geoSearch(array $params = ['query', 'lat', 'long', 'ip', 'accuracy', 'granularity', 'max_results', 'contained_within'])
7328
* @method \Psr\Http\Message\ResponseInterface helpConfiguration()
7429
* @method \Psr\Http\Message\ResponseInterface helpLanguages()
7530
* @method \Psr\Http\Message\ResponseInterface helpPrivacy()
7631
* @method \Psr\Http\Message\ResponseInterface helpTos()
7732
* @method \Psr\Http\Message\ResponseInterface homeTimeline(array $params = ['exclude_replies', 'trim_user', 'count', 'until', 'since_id', 'max_id', 'skip_status', 'include_entities'])
7833
* @method \Psr\Http\Message\ResponseInterface lists(array $params = ['user_id', 'screen_name', 'reverse'])
79-
* @method \Psr\Http\Message\ResponseInterface listsCreate(array $body = ['name', 'mode', 'description'])
80-
* @method \Psr\Http\Message\ResponseInterface listsDestroy(array $body = ['list_id', 'slug', 'owner_screen_name', 'owner_id'])
8134
* @method \Psr\Http\Message\ResponseInterface listsMembers(array $params = ['list_id', 'slug', 'owner_screen_name', 'owner_id', 'count', 'cursor', 'include_entities', 'skip_status'])
82-
* @method \Psr\Http\Message\ResponseInterface listsMembersCreate(array $body = ['list_id', 'slug', 'user_id', 'screen_name', 'owner_screen_name', 'owner_id'])
83-
* @method \Psr\Http\Message\ResponseInterface listsMembersCreateAll(array $body = ['list_id', 'slug', 'user_id', 'screen_name', 'owner_screen_name', 'owner_id'])
84-
* @method \Psr\Http\Message\ResponseInterface listsMembersDestroy(array $body = ['list_id', 'slug', 'user_id', 'screen_name', 'owner_screen_name', 'owner_id'])
85-
* @method \Psr\Http\Message\ResponseInterface listsMembersDestroyAll(array $body = ['list_id', 'slug', 'user_id', 'screen_name', 'owner_screen_name', 'owner_id'])
8635
* @method \Psr\Http\Message\ResponseInterface listsMembersShow(array $params = ['list_id', 'slug', 'user_id', 'screen_name', 'owner_screen_name', 'owner_id', 'include_entities', 'skip_status'])
8736
* @method \Psr\Http\Message\ResponseInterface listsMemberships(array $params = ['user_id', 'screen_name', 'count', 'cursor', 'filter_to_owned_lists'])
8837
* @method \Psr\Http\Message\ResponseInterface listsOwnerships(array $params = ['user_id', 'screen_name', 'count', 'cursor'])
8938
* @method \Psr\Http\Message\ResponseInterface listsShow(array $params = ['list_id', 'slug', 'owner_screen_name', 'owner_id'])
9039
* @method \Psr\Http\Message\ResponseInterface listsStatuses(array $params = ['list_id', 'slug', 'owner_screen_name', 'owner_id', 'count', 'since_id', 'max_id', 'trim_user', 'include_rts', 'include_entities'])
9140
* @method \Psr\Http\Message\ResponseInterface listsSubscribers(array $params = ['list_id', 'slug', 'owner_screen_name', 'owner_id', 'count', 'cursor', 'trim_user', 'skip_status', 'include_entities'])
92-
* @method \Psr\Http\Message\ResponseInterface listsSubscribersCreate(array $body = ['list_id', 'slug', 'owner_screen_name', 'owner_id'])
93-
* @method \Psr\Http\Message\ResponseInterface listsSubscribersDestroy(array $body = ['list_id', 'slug', 'owner_screen_name', 'owner_id'])
9441
* @method \Psr\Http\Message\ResponseInterface listsSubscribersShow(array $params = ['owner_screen_name', 'owner_id', 'list_id', 'slug', 'user_id', 'screen_name', 'skip_status', 'include_entities'])
9542
* @method \Psr\Http\Message\ResponseInterface listsSubscriptions(array $params = ['user_id', 'screen_name', 'count', 'cursor'])
96-
* @method \Psr\Http\Message\ResponseInterface listsUpdate(array $body = ['list_id', 'slug', 'name', 'mode', 'description', 'owner_screen_name', 'owner_id'])
9743
* @method \Psr\Http\Message\ResponseInterface mentionsTimeline(array $params = ['count', 'since_id', 'max_id', 'trim_user', 'skip_status', 'include_entities'])
98-
* @method \Psr\Http\Message\ResponseInterface mute(array $body = ['user_id', 'screen_name', 'include_entities', 'skip_status'])
99-
* @method \Psr\Http\Message\ResponseInterface mutesUsersIds(array $params = ['cursor', 'stringify_ids'])
100-
* @method \Psr\Http\Message\ResponseInterface mutesUsersList(array $params = ['cursor', 'include_entities', 'skip_status'])
10144
* @method \Psr\Http\Message\ResponseInterface rateLimitStatus(array $params = ['resources'])
102-
* @method \Psr\Http\Message\ResponseInterface reportSpam(array $body = ['user_id', 'screen_name', 'perform_block'])
103-
* @method \Psr\Http\Message\ResponseInterface retweet(string $id, array $body = ['trim_user'])
104-
* @method \Psr\Http\Message\ResponseInterface savedSearchesCreate(array $body = ['query'])
105-
* @method \Psr\Http\Message\ResponseInterface savedSearchesDestroy(string $id)
106-
* @method \Psr\Http\Message\ResponseInterface savedSearchesList()
107-
* @method \Psr\Http\Message\ResponseInterface savedSearchesShow(string $id)
10845
* @method \Psr\Http\Message\ResponseInterface searchTweets(array $params = ['q', 'geocode', 'lang', 'locale', 'result_type', 'count', 'until', 'since_id', 'max_id', 'skip_status', 'include_entities'])
109-
* @method \Psr\Http\Message\ResponseInterface statusesDestroyId(string $id, array $body = ['trim_user'])
11046
* @method \Psr\Http\Message\ResponseInterface statusesLookup(array $params = ['id', 'trim_user', 'map', 'include_ext_alt_text', 'skip_status', 'include_entities'])
11147
* @method \Psr\Http\Message\ResponseInterface statusesRetweetersIds(array $params = ['id', 'stringify_ids', 'cursor'])
11248
* @method \Psr\Http\Message\ResponseInterface statusesRetweetsId(string $id, array $params = ['trim_user', 'include_my_retweet', 'include_entities', 'include_ext_alt_text'])
113-
* @method \Psr\Http\Message\ResponseInterface statusesRetweetsOfMe(array $params = ['count', 'since_id', 'max_id', 'trim_user', 'skip_status', 'include_entities', 'include_user_entities'])
11449
* @method \Psr\Http\Message\ResponseInterface statusesShowId(string $id, array $params = ['trim_user', 'include_my_retweet', 'include_entities', 'include_ext_alt_text'])
11550
* @method \Psr\Http\Message\ResponseInterface trendsAvailable()
11651
* @method \Psr\Http\Message\ResponseInterface trendsClosest(array $params = ['lat', 'long'])
11752
* @method \Psr\Http\Message\ResponseInterface trendsPlace(array $params = ['id', 'exclude'])
118-
* @method \Psr\Http\Message\ResponseInterface unblock(array $body = ['user_id', 'screen_name', 'include_entities', 'skip_status'])
119-
* @method \Psr\Http\Message\ResponseInterface unfavorite(array $body = ['id', 'include_entities'])
120-
* @method \Psr\Http\Message\ResponseInterface unfollow(array $body = ['user_id', 'screen_name'])
121-
* @method \Psr\Http\Message\ResponseInterface unmute(array $body = ['user_id', 'screen_name', 'include_entities', 'skip_status'])
122-
* @method \Psr\Http\Message\ResponseInterface unretweet(string $id, array $body = ['trim_user'])
12353
* @method \Psr\Http\Message\ResponseInterface userTimeline(array $params = ['user_id', 'screen_name', 'since_id', 'count', 'max_id', 'trim_user', 'exclude_replies', 'include_rts', 'include_entities'])
12454
* @method \Psr\Http\Message\ResponseInterface usersLookup(array $params = ['user_id', 'screen_name', 'include_entities', 'skip_status'])
125-
* @method \Psr\Http\Message\ResponseInterface usersProfileBanner(array $params = ['user_id', 'screen_name'])
12655
* @method \Psr\Http\Message\ResponseInterface usersSearch(array $params = ['q', 'page', 'count', 'include_entities', 'skip_status'])
12756
* @method \Psr\Http\Message\ResponseInterface usersShow(array $params = ['user_id', 'screen_name', 'include_entities', 'skip_status'])
128-
* @method \Psr\Http\Message\ResponseInterface usersSuggestions(array $params = ['lang'])
129-
* @method \Psr\Http\Message\ResponseInterface usersSuggestionsSlug(string $slug, array $params = ['lang'])
130-
* @method \Psr\Http\Message\ResponseInterface usersSuggestionsSlugMembers(string $slug, array $params = ['lang'])
131-
* @method \Psr\Http\Message\ResponseInterface verifyCredentials(array $params = ['include_entities', 'skip_status'])
13257
*/
13358
class TwitterCC extends OAuth2Provider implements ClientCredentials{
13459

13560
protected const AUTH_ERRMSG = 'TwitterCC only supports Client Credentials Grant, use the Twitter OAuth1 class for authentication instead.';
13661

137-
protected ?string $apiURL = 'https://api.twitter.com/1.1';
62+
protected ?string $apiURL = 'https://api.twitter.com';
13863
protected ?string $clientCredentialsTokenURL = 'https://api.twitter.com/oauth2/token';
13964
protected ?string $userRevokeURL = 'https://twitter.com/settings/applications';
140-
protected ?string $endpointMap = TwitterEndpoints::class;
65+
protected ?string $endpointMap = TwitterCCEndpoints::class;
14166
protected ?string $apiDocs = 'https://developer.twitter.com/en/docs/basics/authentication/overview/application-only';
14267
protected ?string $applicationURL = 'https://developer.twitter.com/apps';
14368

0 commit comments

Comments
 (0)