\Iqrf\Repository\UtilsFileClient

HTTP(S) client for file downloading

Summary

Methods
Properties
Constants
__construct()
sendRequest()
setPath()
getFile()
No public properties found
No constants found
No protected methods found
$configuration
$httpClient
N/A
No private methods found
$path
N/A

Properties

$configuration

$configuration : \Iqrf\Repository\Configuration

Type

Configuration — Configuration

$httpClient

$httpClient : \GuzzleHttp\Client

Type

\GuzzleHttp\Client — HTTP(S) client

$path

$path : string|null

Type

string|null — Base path

Methods

__construct()

__construct(\Iqrf\Repository\Configuration  $config, \GuzzleHttp\Client  $httpClient) : mixed

Constructor

Parameters

\Iqrf\Repository\Configuration $config

Configuration

\GuzzleHttp\Client $httpClient

HTTP(S) client

Returns

mixed —

sendRequest()

sendRequest(string  $url, array|null  $query = null, bool  $useCredentials = false) : string

Sends HTTP request

Parameters

string $url

URL

array|null $query

Optional query parameters

bool $useCredentials

Throws

\Iqrf\Repository\Exceptions\DataNotFound
\Iqrf\Repository\Exceptions\ServiceUnavailable

Returns

string —

HTTP response

setPath()

setPath(string  $path) : void

Sets the base path

Parameters

string $path

Base path

getFile()

getFile(string  $path, bool  $useCredentials = false) : string

Downloads the file from the IQRF Repository

Parameters

string $path

File path

bool $useCredentials

Use credentials

Throws

\BadMethodCallException
\Iqrf\Repository\Exceptions\DataNotFound
\Iqrf\Repository\Exceptions\ServiceUnavailable

Returns

string —

File content