\Iqrf\Repository\Models FilesManager

Files manager

Summary

Methods
Properties
Constants
__construct
setPath
download
get
list
useCredentials
No public constants found
No protected methods found
No protected properties found
No protected constants found
No private methods found
httpClient
No private constants found

Properties

$useCredentials

$useCredentials : bool

Type

bool

$httpClient

$httpClient : \Iqrf\Repository\Utils\FileClient

Type

FileClient

Methods

__construct()

__construct(\Iqrf\Repository\Utils\FileClient  $httpClient, bool  $useCredentials = false) : mixed

Constructor

Parameters

\Iqrf\Repository\Utils\FileClient $httpClient

HTTP(S) file client

bool $useCredentials

Use credentials

Returns

mixed —

setPath()

setPath(string  $path) : void

Sets the base path

Parameters

string $path

Base path

Returns

void —

download()

download(string  $fileName) : string|null

Download the file and returns its content

Parameters

string $fileName

File name

Throws

\Iqrf\Repository\Exceptions\FileNotFound

Requested file not found

\Iqrf\Repository\Exceptions\ServiceUnavailable

IQRF Repository API is unavailable

Returns

string|null —

File content

get()

get(string  $fileName) : \Iqrf\Repository\Entities\File|null

Return the file entity

Parameters

string $fileName

File name

Throws

\Iqrf\Repository\Exceptions\CorruptedData

Corrupted data in the API response

\Iqrf\Repository\Exceptions\FileNotFound

Requested file not found

\Iqrf\Repository\Exceptions\ServiceUnavailable

IQRF Repository API is unavailable

Returns

\Iqrf\Repository\Entities\File|null —

File

list()

list() : \Iqrf\Repository\Entities\Files

Lists files

Throws

\Iqrf\Repository\Exceptions\CorruptedData

Corrupted data in the API response

\Iqrf\Repository\Exceptions\FileNotFound

No files found

\Iqrf\Repository\Exceptions\ServiceUnavailable

IQRF Repository API is unavailable

Returns

\Iqrf\Repository\Entities\Files —

Files