Pili\Api::streamUpdate PHP Method

streamUpdate() public static method

public static streamUpdate ( $transport, $streamId, $options = [] )
    public static function streamUpdate($transport, $streamId, $options = array())
    {
        $url = self::_getApiBaseUrl() . "streams/{$streamId}";
        $params = array();
        $keys = array('publishKey', 'publishSecurity', 'disabled');
        foreach ($keys as $key) {
            if (isset($options[$key])) {
                $params[$key] = $options[$key];
            }
        }
        $body = json_encode($params);
        $body = empty($body) ? '{}' : $body;
        return $transport->send(HttpRequest::POST, $url, $body);
    }

Usage Example

Example #1
0
 public function update()
 {
     $stream = Api::streamUpdate($this->_transport, $this->id, $this->_data);
     return new Stream($this->_transport, $stream);
 }