<html><head><title>WebService::Hexonet::Connector::Response</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" >
</head>
<body class='pod'>
<!--
  generated by Pod::Simple::HTML v3.35,
  using Pod::Simple::PullParser v3.35,
  under Perl v5.030001 at Thu Jul 16 08:59:57 2020 GMT.

 If you want to change this HTML document, you probably shouldn't do that
   by changing it directly.  Instead, see about changing the calling options
   to Pod::Simple::HTML, and/or subclassing Pod::Simple::HTML,
   then reconverting this document from the Pod source.
   When in doubt, email the author of Pod::Simple::HTML for advice.
   See 'perldoc Pod::Simple::HTML' for more info.

-->

<!-- start doc -->
<a name='___top' class='dummyTopAnchor' ></a>

<h1><a class='u'
name="NAME"
>NAME</a></h1>

<p>WebService::Hexonet::Connector::Response - Library to provide accessibility to API response data.</p>

<h1><a class='u'
name="SYNOPSIS"
>SYNOPSIS</a></h1>

<p>This module is internally used by the <a href="http://search.cpan.org/perldoc?WebService%3A%3AHexonet%3A%3AConnector%3A%3AAPIClient" class="podlinkpod"
>WebService::Hexonet::Connector::APIClient</a> module.
To be used in the way:</p>

<pre>    # specify the used API command (used for the request that responsed with $plain)
    $command = {
            COMMAND =&#62; &#39;StatusAccount&#39;
    };
    # Optionally specify replacements for place holders in static response templates e.g. {CONNECTION_URL}
    # see ResponseTemplateManager. This makes of course sense and is handled internally by APIClient automatically.
    # When using Repsonse class in unit tests, you could leave this probably out.
    $ph = {
        CONNECTION_URL =&#62; &#39;https://api.ispapi.net/api/call.cgi&#39;
    };

    # specify the API plain-text response (this is just an example that won&#39;t fit to the command above)
    $plain = &#34;[RESPONSE]\r\nCODE=200\r\nDESCRIPTION=Command completed successfully\r\nEOF\r\n&#34;;

    # create a new instance by
    $r = WebService::Hexonet::Connector::Response-&#62;new($plain, $command, $ph);</pre>

<h1><a class='u'
name="DESCRIPTION"
>DESCRIPTION</a></h1>

<p>HEXONET Backend API always responds in plain-text format that needs to get parsed into a useful data structure. This module manages all this: parsing data into hash format, into columns and records. It provides different methods to access the data to fit your needs.</p>

<h2><a class='u'
name="Methods"
>Methods</a></h2>

<dl>
<dt><a name="new(_$plain,_$command,_$ph_)"
><code>new( $plain, $command, $ph )</code></a></dt>

<dd>
<p>Returns a new <a href="http://search.cpan.org/perldoc?WebService%3A%3AHexonet%3A%3AConnector%3A%3AResponse" class="podlinkpod"
>WebService::Hexonet::Connector::Response</a> object. Specify the plain-text API response by $plain. Specify the used command by $command. Specify the hash covering all place holder variable&#39;s replacement values by $ph. Optional.</p>

<dt><a name="addColumn(_$key,_@data_)"
><code>addColumn( $key, @data )</code></a></dt>

<dd>
<p>Add a new column. Specify the column name by $key. Specify the column data by @data. Returns the current <a href="http://search.cpan.org/perldoc?WebService%3A%3AHexonet%3A%3AConnector%3A%3AResponse" class="podlinkpod"
>WebService::Hexonet::Connector::Response</a> instance in use for method chaining.</p>

<dt><a name="addRecord(_$hash_)"
><code>addRecord( $hash )</code></a></dt>

<dd>
<p>Add a new record. Specify the row data in hash notation by $hash. Where the hash key represents the column name. Where the hash value represents the row value for that column. Returns the current <a href="http://search.cpan.org/perldoc?WebService%3A%3AHexonet%3A%3AConnector%3A%3AResponse" class="podlinkpod"
>WebService::Hexonet::Connector::Response</a> instance in use for method chaining.</p>

<dt><a name="getColumn(_$key_)"
><code>getColumn( $key )</code></a></dt>

<dd>
<p>Get a column for the specified column name $key. Returns an instance of <a href="http://search.cpan.org/perldoc?WebService%3A%3AHexonet%3A%3AConnector%3A%3AColumn" class="podlinkpod"
>WebService::Hexonet::Connector::Column</a>.</p>

<dt><a name="getColumnIndex(_$key,_$index_)_{"
><code>getColumnIndex( $key, $index )</code> {</a></dt>

<dd>
<p>Get Data of the specified column $key for the given column index $index. Returns a scalar.</p>

<dt><a name="getColumnKeys"
><code>getColumnKeys</code></a></dt>

<dd>
<p>Get a list of available column names. NOTE: columns may differ in their data size. Returns an array.</p>

<dt><a name="getCommand"
><code>getCommand</code></a></dt>

<dd>
<p>Get the command used within the request that resulted in this api response. This is in general the command you provided in the constructor. Returns a hash.</p>

<dt><a name="getCommandPlain"
><code>getCommandPlain</code></a></dt>

<dd>
<p>Get the command in plain text that you used within the API request of this response. This is in general the command you provided in the constructor. Returns a string.</p>

<dt><a name="getCurrentPageNumber"
><code>getCurrentPageNumber</code></a></dt>

<dd>
<p>Returns the current page number we are in with this API response as int. Returns -1 if not found.</p>

<dt><a name="getCurrentRecord"
><code>getCurrentRecord</code></a></dt>

<dd>
<p>Returns the current record of the iteration. It internally uses recordIndex as iterator index. Returns an instance of <a href="http://search.cpan.org/perldoc?WebService%3A%3AHexonet%3A%3AConnector%3A%3ARecord" class="podlinkpod"
>WebService::Hexonet::Connector::Record</a>. Returns undef if not found.</p>

<dt><a name="getFirstRecordIndex"
><code>getFirstRecordIndex</code></a></dt>

<dd>
<p>Returns the first record index of this api response as int. Returns undef if not found.</p>

<dt><a name="getLastRecordIndex"
><code>getLastRecordIndex</code></a></dt>

<dd>
<p>Returns the last record index of this api response as int. Returns undef if not found.</p>

<dt><a name="getListHash"
><code>getListHash</code></a></dt>

<dd>
<p>Returns this api response in a List-Hash format. You will find the row data under hash key &#34;LIST&#34;. You will find meta data under hash key &#34;meta&#34;. Under &#34;meta&#34; data you will again find a hash, where hash key &#34;columns&#34; provides you a list of available column names and &#34;pg&#34; provides you useful paginator data. This method is thought to be used if you need something that helps you realizing tables with or without a pager. Returns a Hash.</p>

<dt><a name="getNextRecord"
><code>getNextRecord</code></a></dt>

<dd>
<p>Returns the next record of the current iteration. Returns an instance of <a href="http://search.cpan.org/perldoc?WebService%3A%3AHexonet%3A%3AConnector%3A%3ARecord" class="podlinkpod"
>WebService::Hexonet::Connector::Record</a>. Returns undef if not found.</p>

<dt><a name="getNextPageNumber"
><code>getNextPageNumber</code></a></dt>

<dd>
<p>Returns the number of the next api response page for the current request as int. Returns -1 if not found.</p>

<dt><a name="getNumberOfPages"
><code>getNumberOfPages</code></a></dt>

<dd>
<p>Returns the total number of response pages in our API for the current request as int.</p>

<dt><a name="getPagination"
><code>getPagination</code></a></dt>

<dd>
<p>Returns paginator data of the current response / request. Returns a hash.</p>

<dt><a name="getPreviousPageNumber"
><code>getPreviousPageNumber</code></a></dt>

<dd>
<p>Returns the number of the previous api response page for the current request as int. Returns -1 if not found.</p>

<dt><a name="getPreviousRecord"
><code>getPreviousRecord</code></a></dt>

<dd>
<p>Returns the previous record of the current iteration. Returns undef if not found otherwise an instance of <a href="http://search.cpan.org/perldoc?WebService%3A%3AHexonet%3A%3AConnector%3A%3ARecord" class="podlinkpod"
>WebService::Hexonet::Connector::Record</a>.</p>

<dt><a name="getRecord(_$index_)"
><code>getRecord( $index )</code></a></dt>

<dd>
<p>Returns the record of the specified record index $index. Returns undef if not found otherwise an instance of <a href="http://search.cpan.org/perldoc?WebService%3A%3AHexonet%3A%3AConnector%3A%3ARecord" class="podlinkpod"
>WebService::Hexonet::Connector::Record</a>.</p>

<dt><a name="getRecords"
><code>getRecords</code></a></dt>

<dd>
<p>Returns a list of available records. Returns an array of instances of <a href="http://search.cpan.org/perldoc?WebService%3A%3AHexonet%3A%3AConnector%3A%3ARecord" class="podlinkpod"
>WebService::Hexonet::Connector::Record</a>.</p>

<dt><a name="getRecordsCount"
><code>getRecordsCount</code></a></dt>

<dd>
<p>Returns the amount of returned records for the current request as int.</p>

<dt><a name="getRecordsTotalCount"
><code>getRecordsTotalCount</code></a></dt>

<dd>
<p>Returns the total amount of available records for the current request as int.</p>

<dt><a name="getRecordsLimitation"
><code>getRecordsLimitation</code></a></dt>

<dd>
<p>Returns the limitation of the current request as int. LIMIT = ... NOTE: Our system comes with a default limitation if you do not specify a limitation in list commands to avoid data load in our systems. This limitation is then returned in column &#34;LIMIT&#34; at index 0.</p>

<dt><a name="hasNextPage"
><code>hasNextPage</code></a></dt>

<dd>
<p>Checks if a next response page exists for the current query. Returns boolean 0 or 1.</p>

<dt><a name="hasPreviousPage"
><code>hasPreviousPage</code></a></dt>

<dd>
<p>Checks if a previous response page exists for the current query. Returns boolean 0 or 1.</p>

<dt><a name="rewindRecordList"
><code>rewindRecordList</code></a></dt>

<dd>
<p>Resets the current iteration to index 0.</p>

<dt><a name="_hasColumn(_$key_)"
><code>_hasColumn( $key )</code></a></dt>

<dd>
<p>Private method. Checks if a column specified by $key exists. Returns boolean 0 or 1.</p>

<dt><a name="_hasCurrentRecord"
><code>_hasCurrentRecord</code></a></dt>

<dd>
<p>Private method. Checks if the current record exists in the iteration. Returns boolean 0 or 1.</p>

<dt><a name="_hasNextRecord"
><code>_hasNextRecord</code></a></dt>

<dd>
<p>Private method. Checks if the next record exists in the iteration. Returns boolean 0 or 1.</p>

<dt><a name="_hasPreviousRecord"
><code>_hasPreviousRecord</code></a></dt>

<dd>
<p>Private method. Checks if the previous record exists in the iteration. Returns boolean 0 or 1.</p>
</dd>
</dl>

<h1><a class='u'
name="LICENSE_AND_COPYRIGHT"
>LICENSE AND COPYRIGHT</a></h1>

<p>This program is licensed under the <a href="https://raw.githubusercontent.com/hexonet/perl-sdk/master/LICENSE" class="podlinkurl"
>MIT License</a>.</p>

<h1><a class='u'
name="AUTHOR"
>AUTHOR</a></h1>

<p><a href="https://www.hexonet.net" class="podlinkurl"
>HEXONET GmbH</a></p>

<!-- end doc -->

</body></html>