how to get the url to usefor a private path
You can't call PrivateStream::getExternalUrl() directly because it's not a static function; it needs an instantiated stream before you can call getExternalUrl() on it. 

You can retrieve it via the stream wrapper manager's getViaUri() method: 

$stream = \Drupal::service('stream_wrapper_manager')-&gt;getViaUri('private:://somefile.txt');
$stream-&gt;getExternalUrl();