interface ExtendedResponseInterface implements ResponseInterface (View source)

Extended Response Interface

The optional capabilities of a richer API surface (currently CentralNic Reseller): server-side telemetry (queuetime/runtime), transient/pending status signals and the table-friendly list-hash projection. These are NOT part of the universal {\CNIC\ResponseInterface} because flat APIs such as IBS/Moniker do not provide them — their responses implement the core interface only. Consumers holding the shared type narrow to this one via instanceof ExtendedResponseInterface before using any of these methods.

Methods

int
getCode()

Get API response code

string
getDescription()

Get API response description

string
getRequestURL()

Get Request URL

string
getPlain()

Get Plain API response

array
getHash()

Get API response as Hash

bool
isError()

Check if current API response represents an error case (a 5xx code)

bool
isSuccess()

Check if current API response represents a success case (a 2xx code)

getColumn(string $columnName)

Get column by column name, or null if the column does not exist

mixed
getColumnIndex(string $columnName, int $recordIndex)

Get Data by Column Name and Index, or null if not found

array
getColumnKeys()

Get Column Names — the response's data columns, in wire order.

array
getColumns()

Get List of Columns

array
getCommand()

Get Command used in this request

string
getCommandPlain()

Get Command used in this request in plain text format

array
getContext()

Get context data for the response

int|null
getFirstRecordIndex()

Get Index of first row in this response — the offset the current window starts at, or null when the response carries no pagination metadata (a non-list response).

int|null
getLastRecordIndex()

Get last record index of the current list query, or null when the response carries no pagination metadata (a non-list response).

getPagination()

Get the paginator for this response's list window.

getRecord(int $recordIndex)

Get Record at given index, or null if the index does not exist

array
getRecords()

Get all Records

getIterator()

Iterate the record list, keyed by record index.

int
getRecordsCount()

Get count of rows in this response

int|null
getRecordsTotalCount()

Get total count of records available for the list query, or null when the response carries no TOTAL metadata (a non-list response)

int|null
getRecordsLimitation()

Get limit(ation) setting of the current list query — the count of requested rows — or null when the response carries no LIMIT metadata.

float
getQueuetime()

Get Queuetime of API response

float
getRuntime()

Get Runtime of API response

bool
isTmpError()

Check if current API response represents a temporary error case (a 4xx code)

bool
isPending()

Check if current operation is returned as pending

array
getListHash()

Get Response as List Hash including useful meta data for tables

Details

int getCode()

Get API response code

Return Value

int

string getDescription()

Get API response description

Return Value

string

string getRequestURL()

Get Request URL

Return Value

string

string getPlain()

Get Plain API response

Return Value

string

array getHash()

Get API response as Hash

Return Value

array

API response hash

bool isError()

Check if current API response represents an error case (a 5xx code)

Return Value

bool

bool isSuccess()

Check if current API response represents a success case (a 2xx code)

Return Value

bool

ColumnInterface|null getColumn(string $columnName)

Get column by column name, or null if the column does not exist

Parameters

string $columnName

Return Value

ColumnInterface|null

mixed getColumnIndex(string $columnName, int $recordIndex)

Get Data by Column Name and Index, or null if not found

Parameters

string $columnName
int $recordIndex

Return Value

mixed

array getColumnKeys()

Get Column Names — the response's data columns, in wire order.

Never includes the brand's response metadata (CNR: TOTAL, FIRST, LAST, COUNT, LIMIT; IBS: transactid, status, message, code, the total_ prefixed keys and domaincount). Those are not columns at all since RSRMID-2965 — read them through {\CNIC\self::getPagination()} and the status accessors instead of {\CNIC\self::getColumn()}/{@see \CNIC\self::getColumnIndex()}. The former getColumnKeys(true) that stripped them is gone: with the column set correct there is nothing left to strip.

Return Value

array

Array of Column Names

array getColumns()

Get List of Columns

Return Value

array

Array of Columns

array getCommand()

Get Command used in this request

Return Value

array command

string getCommandPlain()

Get Command used in this request in plain text format

Return Value

string

array getContext()

Get context data for the response

Return Value

array

context data

int|null getFirstRecordIndex()

Get Index of first row in this response — the offset the current window starts at, or null when the response carries no pagination metadata (a non-list response).

A pure read of the brand's own wire metadata since RSRMID-2965: it no longer falls back to 0 because rows happen to be present, so "this is page 1" and "this is not a list" are distinguishable answers.

Return Value

int|null

int|null getLastRecordIndex()

Get last record index of the current list query, or null when the response carries no pagination metadata (a non-list response).

Also a pure wire read since RSRMID-2965 — no getRecordsCount() - 1 fallback. Note it is an offset into the whole result set, not an index into {\CNIC\self::getRecords()}: the window FIRST=100, LIMIT=10 answers 109 here, while its last row is getRecord(9). The two coincide on the first page only.

Return Value

int|null

Paginator getPagination()

Get the paginator for this response's list window.

Everything derived from the four primitives above — page numbers, the page count and the has-next/has-previous predicates — is answered by {\CNIC\Paginator} rather than by this interface (RSRMID-2965). It reads no wire payload, so pagination arithmetic can be exercised without one, and a caller who never pages is not carrying six methods for it.

The former array is getPagination()->toArray(), unchanged in keys and order.

Return Value

Paginator

RecordInterface|null getRecord(int $recordIndex)

Get Record at given index, or null if the index does not exist

Parameters

int $recordIndex

Return Value

RecordInterface|null

array getRecords()

Get all Records

Return Value

array

array of records

Traversable getIterator()

Iterate the record list, keyed by record index.

Redeclared here — {\IteratorAggregate} already requires it — so the element type is stated on the contract consumers type against, rather than only where it happens to be implemented. foreach is the supported way to walk the rows: it holds its position in the loop rather than on the response, so nothing a caller does while iterating is visible to another holder of the same response, and a second foreach starts from the top with no rewind step. See the class docblock for what this replaced.

Return Value

Traversable

int getRecordsCount()

Get count of rows in this response

Return Value

int

int|null getRecordsTotalCount()

Get total count of records available for the list query, or null when the response carries no TOTAL metadata (a non-list response)

Return Value

int|null

int|null getRecordsLimitation()

Get limit(ation) setting of the current list query — the count of requested rows — or null when the response carries no LIMIT metadata.

0 is a distinct, meaningful value (LIMIT=0 was requested); it no longer collides with "absent"

Return Value

int|null

float getQueuetime()

Get Queuetime of API response

Return Value

float

float getRuntime()

Get Runtime of API response

Return Value

float

bool isTmpError()

Check if current API response represents a temporary error case (a 4xx code)

Return Value

bool

bool isPending()

Check if current operation is returned as pending

Return Value

bool

array getListHash()

Get Response as List Hash including useful meta data for tables

Return Value

array

hash including list meta data and array of rows in hash notation