ApiOpenStudio PHPDoc

Url extends ProcessorEntity
in package

Class Url

Provide the results from a remote endpoint.

Table of Contents

$id  : mixed
Processor ID.
$data  : string
$db  : ADOConnection|null
DB connections.
$details  : array<string|int, mixed>
{@inheritDoc}
$logger  : MonologWrapper
Logger object.
$meta  : mixed
Meta required for this processor.
$request  : Request
All the request details.
__construct()  : mixed
Entity constructor.
details()  : array<string|int, mixed>
Return details for processor.
process()  : DataContainer
{@inheritDoc}
val()  : mixed|DataContainer
Process a variable into a final result for the processor.
generateParams()  : array<string|int, mixed>
Generate the params array for the sql search.
getCurloptFromString()  : mixed
Convert a CURL string constant to it's numerical equivalent.
isDataContainer()  : bool
Validate if a set of data is wrapped in a DataContainer object.
calcFormat()  : string
Calculate the format of the data.
validateAllowedTypes()  : void
Validate an input for allowed variable types
validateAllowedValues()  : void
Validate an input for allowed values.

Properties

$id

Processor ID.

public mixed $id = ''

Processor ID.

$data

protected string $data

Curl response.

$details

{@inheritDoc}

protected array<string|int, mixed> $details = ['name' => 'Url', 'machineName' => 'url', 'description' => 'Fetch the result form an external URL.', 'menu' => 'Endpoint', 'input' => ['method' => ['description' => 'The HTTP method.', 'cardinality' => [1, 1], 'literalAllowed' => true, 'limitProcessors' => [], 'limitTypes' => ['text'], 'limitValues' => ['get', 'post'], 'default' => ''], 'url' => ['description' => 'The source URL.', 'cardinality' => [1, 1], 'literalAllowed' => true, 'limitProcessors' => [], 'limitTypes' => ['text'], 'limitValues' => [], 'default' => ''], 'expected_type' => [ // phpcs:ignore 'description' => 'Manually declare the source type (the fastest), or allow ApiOpenStudio to detect the type ("auto"). If auto is selected, CSV and invalid JSON/XML will be treated as text.', 'cardinality' => [0, 1], 'literalAllowed' => true, 'limitProcessors' => [], 'limitTypes' => ['text'], 'limitValues' => ['image', 'xml', 'json', 'text', 'html', 'auto'], 'default' => 'auto', ], 'body' => ['description' => 'The body of the request.', 'cardinality' => [0, 1], 'literalAllowed' => true, 'limitProcessors' => [], 'limitTypes' => ['text'], 'limitValues' => [], 'default' => ''], 'auth' => ['description' => 'The remote authentication process.', 'cardinality' => [0, '*'], 'literalAllowed' => true, 'limitProcessors' => ['AuthCookie', 'AuthOauthHeader', 'AuthBasic', 'AuthDigest'], 'limitTypes' => [], 'limitValues' => [], 'default' => null], 'report_error' => ['description' => 'Stop processing if the remote source responds with an error.', 'cardinality' => [0, 1], 'literalAllowed' => true, 'limitProcessors' => [], 'limitTypes' => ['boolean'], 'limitValues' => [], 'default' => true], 'connect_timeout' => [ // phpcs:ignore 'description' => 'The number of seconds to wait while trying to connect. Indefinite wait time of 0 is disallowed (optional).', 'cardinality' => [0, 1], 'literalAllowed' => true, 'limitProcessors' => [], 'limitTypes' => ['integer'], 'limitValues' => [], 'default' => null, ], 'timeout' => [ // phpcs:ignore 'description' => 'The maximum number of seconds to allow the remote call to execute (optional). This time will include connectTimeout value.', 'cardinality' => [0, 1], 'literalAllowed' => true, 'limitProcessors' => [], 'limitTypes' => ['integer'], 'limitValues' => [], 'default' => null, ]]]

Details of the processor.

$meta

Meta required for this processor.

protected mixed $meta

Processor metadata.

$request

All the request details.

protected Request $request

Request.

Methods

__construct()

Entity constructor.

public __construct( $meta, Request &$request[, MonologWrapper|null $logger = null ]) : mixed
Parameters
$meta :

Metadata for the processor.

$request : Request

The full request object.

$logger : MonologWrapper|null = null

The logger.

Return values
mixed

details()

Return details for processor.

public details() : array<string|int, mixed>
Return values
array<string|int, mixed>

val()

Process a variable into a final result for the processor.

public val(string $key[, bool|null $rawData = null ]) : mixed|DataContainer

This method can be used to process a value in its meta to return a final result that it can use. If the object is a processor, then it will process that down to a final return value, or if the obj is a simple value, then it will return that. Anything else will return an error object.

Setting $realValue to true will force the value to be the actual value, rather than a potential dataContainer.

Parameters
$key : string

The key for the input variable in the meta.

$rawData : bool|null = null

Return the raw data or a DataContainer.

Tags
throws
ApiException

Invalid key or data.

Return values
mixed|DataContainer

generateParams()

Generate the params array for the sql search.

protected generateParams(string|null $keyword, array<string|int, mixed>|null $keywordCols, string|null $orderBy, string|null $direction) : array<string|int, mixed>
Parameters
$keyword : string|null

Search keyword.

$keywordCols : array<string|int, mixed>|null

Columns to search for the keyword.

$orderBy : string|null

Order by column.

$direction : string|null

Order direction.

Return values
array<string|int, mixed>

getCurloptFromString()

Convert a CURL string constant to it's numerical equivalent.

protected getCurloptFromString(string $str) : mixed
Parameters
$str : string

Curl option constant.

Return values
mixed

Curl opt value.

isDataContainer()

Validate if a set of data is wrapped in a DataContainer object.

protected isDataContainer(mixed $data) : bool
Parameters
$data : mixed

DataContainer or raw data.

Return values
bool

calcFormat()

Calculate the format of the data.

private calcFormat() : string
Return values
string

validateAllowedTypes()

Validate an input for allowed variable types

private validateAllowedTypes(string $type, array<string|int, mixed> $limitTypes, int $min, string $key) : void
Parameters
$type : string

Input value type.

$limitTypes : array<string|int, mixed>

List of limit on valiable types.

$min : int

Minimum number of values.

$key : string

The key of the input being validated.

Tags
throws
ApiException

Invalid data type.

Return values
void

validateAllowedValues()

Validate an input for allowed values.

private validateAllowedValues(mixed $val, array<string|int, mixed> $limitValues, int $min, string $key) : void
Parameters
$val : mixed

Input value.

$limitValues : array<string|int, mixed>

List of allowed values.

$min : int

Minimum number of values.

$key : string

The key of the input being validated.

Tags
throws
ApiException

Invalid value.

Return values
void

Search results