You are here

interface AvatarKitDownloadUtilityInterface in Avatar Kit 8.2

Interface for download utility.

Hierarchy

Expanded class hierarchy of AvatarKitDownloadUtilityInterface

All classes that implement AvatarKitDownloadUtilityInterface

File

src/AvatarKitDownloadUtilityInterface.php, line 11

Namespace

Drupal\avatars
View source
interface AvatarKitDownloadUtilityInterface {

  /**
   * Get stream for a file.
   *
   * @param string $uri
   *   The URL of the file to download.
   *
   * @return \Psr\Http\Message\ResponseInterface
   *   The response stream.
   *
   * @throws \InvalidArgumentException
   *   If the URI is defective.
   * @throws \Exception
   *   Various other exceptions thrown from HTTP client.
   */
  public function get(string $uri) : ResponseInterface;

  /**
   * Creates a file entity from a PSR response.
   *
   * @param \Psr\Http\Message\ResponseInterface $response
   *   File to download.
   * @param string $default_filename
   *   The desirable file name. Extension may be substituted.
   *
   * @return \Drupal\file\FileInterface|null
   *   The new file entity, or null if the file could not be downloaded.
   */
  public function createFile(ResponseInterface $response, string $default_filename) : ?FileInterface;

}

Members

Namesort descending Modifiers Type Description Overrides
AvatarKitDownloadUtilityInterface::createFile public function Creates a file entity from a PSR response. 1
AvatarKitDownloadUtilityInterface::get public function Get stream for a file. 1