-
-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: unable to switch API version on service #355 #356
Conversation
Codecov Report
@@ Coverage Diff @@
## main #356 +/- ##
============================================
- Coverage 34.70% 34.48% -0.22%
- Complexity 359 361 +2
============================================
Files 31 32 +1
Lines 804 812 +8
============================================
+ Hits 279 280 +1
- Misses 525 532 +7
Continue to review full report at Codecov.
|
Great work on this 🚀 |
Hey @reliq, sorry to bother you again. The PR does not fix the issue entirely. $twitterV1 = Twitter::forApiV1()->usingCredentials($token, $tokenSecret, env('TWITTER_CONSUMER_KEY'), env('TWITTER_CONSUMER_SECRET'));
$twitterV2 = Twitter::forApiV2()->usingCredentials($token, $tokenSecret, env('TWITTER_CONSUMER_KEY'), env('TWITTER_CONSUMER_SECRET'));
dump($twitterV1);
dd($twitterV2); I have set the TWITTER_API_VERSION to 1.1 in the .env. Response:
Both Instances are Atymic\Twitter\ApiV1\Service\Twitter. The V2 Version should be a V2 Instance. Because of that I cannot access the Methods for the V2: $twitterV1 = $this->getTwitterInstanceV1($token, $tokenSecret, true);
$twitterV2 = $this->getTwitterInstanceV2($token, $tokenSecret, true);
$twitterV2->searchRecent('to:' . 'cosnavel', []); Response
This has the same behavior vice versa. Now with the API Version 2 set in the .env $twitterV1 = Twitter::forApiV1()->usingCredentials($token, $tokenSecret, env('TWITTER_CONSUMER_KEY'), env('TWITTER_CONSUMER_SECRET'));
$twitterV2 = Twitter::forApiV2()->usingCredentials($token, $tokenSecret, env('TWITTER_CONSUMER_KEY'), env('TWITTER_CONSUMER_SECRET'));
dump($twitterV1);
dd($twitterV2); Response:
Example - I tried to get User Information. $twitterV1 = $this->getTwitterInstanceV1($token, $tokenSecret, true);
$twitterV2 = $this->getTwitterInstanceV2($token, $tokenSecret, true);
$this->twitterV1->getUsers(['user_id' => '1234']); Exception:
In fact, the getUsers of V2 gets called. |
This exposes
forApiV1()
andforApiV2
methods which were not previously available on Twitter service.Fixes: #355