Topvisor SDK::Page
Page is an object with the results of an API call.
Class methods
- getResult() - returns results of a call, in case of an API error or API server error, returns null
- getNextOffset() - returns the next offset of the paginated selection, if this is the last page, returns null
- getTotal() - returns the total count of the selection objects of the paginated selection, if this is the last page, returns null
- getHeaders() - returns the array with API call response titles
- getErrors() - returns the array with the errors
- getMessages() - returns the array with the notes
- getErrorsString() - returns all API errors in a single string
- getMessagesString() - returns all API notes in a single string
Example
<?php //.. $projectId = '%NN%'; $selectorKeywords = new TVPen($Session, 'get', 'keywords_2', 'keywords'); $selectorKeywords->setData(['project_id' => $projectId]); $selectorKeywords->setLimit(10); $page = $selectorKeywords->exec(); if(is_null($page->getResult())){ echo $page->getErrorsString(); return; } $countResults = count($page->getResult()); echo "Received keywords: $countResults"; if($page->getTotal()){ echo ' из '.$page->getTotal(); } //...