Пример #1
0
 /**
  * This is not an actual endpoint
  */
 public function __construct($user, $blocked_user, $client = null)
 {
     parent::__construct($client);
     $this->_user = $user;
     $this->_blocked_user = $blocked_user;
     $this->_endpoint = $this->_base_endpoint = "users/{$user}/blocks/{$blocked_user}";
 }
Пример #2
0
 function __construct($channel, $post_id, $client = null)
 {
     parent::__construct($client);
     $this->_channel = $channel;
     $this->_post_id = $post_id;
     $this->_endpoint = $this->_base_endpoint = "feed/{$channel}/posts/{$post_id}";
 }
Пример #3
0
 /**
  * Providing no channel falls back to the /channel endpoint
  *
  * @param string $channel_name
  * @param mixed
  */
 function __construct($channel_name = "", $client = null)
 {
     parent::__construct($client);
     $this->_channel = $channel_name;
     $this->_endpoint = $this->_base_endpoint = 'channels/' . $channel_name;
     if (empty($channel_name)) {
         if (empty(Twitch::getAccessToken())) {
             throw new ChannelException("Please provide a channel name, or use Twitch::setAccessToken() to define the channels access token.");
         }
         if (Twitch::$scope->isAuthorized('channel_read') === false) {
             throw new TwitchScopeException("You do not have sufficient scope priviledges to run this command. Make sure you're authorized for `channel_read`.", 401);
         }
         $this->_endpoint = 'channel';
     }
 }
Пример #4
0
 public function __construct($client = null)
 {
     parent::__construct($client);
     $this->_endpoint = $this->_base_endpoint = 'streams';
 }
Пример #5
0
 public function __construct($channel = false, $client = null)
 {
     parent::__construct($client);
     $this->_channel = $channel;
     $this->_endpoint = $this->_base_endpoint = 'chat';
 }
Пример #6
0
 /**
  * @test
  */
 public function test_recieving_expected_response_decoded()
 {
     $test_file = file_get_contents(__DIR__ . '/data/channel.json');
     $base_method = new BaseMethod($this->getClient([new Response(200, [], $test_file)]));
     $this->assertEquals(json_decode($test_file), $base_method->send());
 }