PHP Class Airship\Engine\Hail

Abstracts away the network communications; silently enforces configuration (e.g. tor-only mode).
Show file Open project: paragonie/airship Class Usage Examples

Protected Properties

Property Type Description
$client Client
$supplierCache Airship\Engine\Continuum\Supplier[]

Public Methods

Method Description
__construct ( ClientInterface $client )
__debugInfo ( ) : array
downloadFile ( string $url, string $filename, array $params = [] ) : Psr\Http\Message\ResponseInterface Download a file over the Internet
get ( string $url, array $params = [] ) : Psr\Http\Message\ResponseInterface Perform a GET request
getAsync ( string $url, array $params = [] ) : Psr\Http\Message\ResponseInterface Perform a GET request, asynchronously
getJSON ( string $url, array $params = [] ) : mixed Perform a GET request, get a decoded JSON response.
getReturnBody ( string $url, array $params = [] ) : string Perform a POST request, get the body
getSignedJSON ( string $url, SignaturePublicKey $publicKey, array $params = [] ) : mixed Perform a GET request, get a decoded JSON response.
params ( array $params = [], string $url = '' ) : array Make sure we include the default params
parseJSON ( Response $response ) : mixed Parse a signed JSON response
parseSignedJSON ( Response $response, SignaturePublicKey $publicKey ) : mixed Parse a signed JSON response
post ( string $url, array $params = [] ) : Psr\Http\Message\ResponseInterface Perform a POST request
postAsync ( string $url, array $params = [] ) : Psr\Http\Message\ResponseInterface Perform a GET request, asynchronously
postJSON ( string $url, array $params = [] ) : mixed Perform a POST request, get a decoded JSON response.
postReturnBody ( string $url, array $params = [] ) : string Perform a POST request, get the body
postSignedJSON ( string $url, SignaturePublicKey $publicKey, array $params = [] ) : mixed Perform a POST request, get a decoded JSON response.

Method Details

__construct() public method

public __construct ( ClientInterface $client )
$client ClientInterface

__debugInfo() public method

public __debugInfo ( ) : array
return array

downloadFile() public method

Download a file over the Internet
public downloadFile ( string $url, string $filename, array $params = [] ) : Psr\Http\Message\ResponseInterface
$url string - the URL to request
$filename string - the name of the local file path
$params array
return Psr\Http\Message\ResponseInterface

get() public method

Perform a GET request
public get ( string $url, array $params = [] ) : Psr\Http\Message\ResponseInterface
$url string
$params array
return Psr\Http\Message\ResponseInterface

getAsync() public method

Perform a GET request, asynchronously
public getAsync ( string $url, array $params = [] ) : Psr\Http\Message\ResponseInterface
$url string
$params array
return Psr\Http\Message\ResponseInterface

getJSON() public method

Perform a GET request, get a decoded JSON response.
public getJSON ( string $url, array $params = [] ) : mixed
$url string
$params array
return mixed

getReturnBody() public method

Perform a POST request, get the body
public getReturnBody ( string $url, array $params = [] ) : string
$url string
$params array
return string

getSignedJSON() public method

Internally verifies an Ed25519 signature.
public getSignedJSON ( string $url, SignaturePublicKey $publicKey, array $params = [] ) : mixed
$url string
$publicKey SignaturePublicKey
$params array
return mixed

params() public method

Make sure we include the default params
public params ( array $params = [], string $url = '' ) : array
$params array
$url string (used for decision-making)
return array

parseJSON() public method

Parse a signed JSON response
public parseJSON ( Response $response ) : mixed
$response Response
return mixed

parseSignedJSON() public method

Parse a signed JSON response
public parseSignedJSON ( Response $response, SignaturePublicKey $publicKey ) : mixed
$response Response
$publicKey SignaturePublicKey
return mixed

post() public method

Perform a POST request
public post ( string $url, array $params = [] ) : Psr\Http\Message\ResponseInterface
$url string
$params array
return Psr\Http\Message\ResponseInterface

postAsync() public method

Perform a GET request, asynchronously
public postAsync ( string $url, array $params = [] ) : Psr\Http\Message\ResponseInterface
$url string
$params array
return Psr\Http\Message\ResponseInterface

postJSON() public method

Perform a POST request, get a decoded JSON response.
public postJSON ( string $url, array $params = [] ) : mixed
$url string
$params array
return mixed

postReturnBody() public method

Perform a POST request, get the body
public postReturnBody ( string $url, array $params = [] ) : string
$url string
$params array
return string

postSignedJSON() public method

Internally verifies an Ed25519 signature.
public postSignedJSON ( string $url, SignaturePublicKey $publicKey, array $params = [] ) : mixed
$url string
$publicKey SignaturePublicKey
$params array
return mixed

Property Details

$client protected property

protected Client $client
return Client

$supplierCache protected property

protected Supplier[],Airship\Engine\Continuum $supplierCache
return Airship\Engine\Continuum\Supplier[]