Update ListList now that we pass an object with QueryResponse

This commit is contained in:
Deon George 2024-08-14 22:18:57 +10:00
parent 0cc4a217bd
commit 9d81824b52
2 changed files with 4 additions and 6 deletions

View File

@ -305,7 +305,7 @@ final class API
$key = 'Item';
$parameters['query'] = 'select * from Item';
return new ListList($this->execute('query',$parameters),$key);
return new ListList($this->execute('query',$parameters,$key),$key);
}
/**

View File

@ -144,9 +144,7 @@ class ListList extends Base implements \Countable, \ArrayAccess, \Iterator
*/
private function data(object $response,string $type): Collection
{
if (! ($x=object_get($response->QueryResponse,$type)))
return collect();
$x = $response->{$type};
switch (Arr::get(self::TYPES,$type)) {
case Category::class:
$data = collect(Category::hydrate($x));
@ -177,8 +175,8 @@ class ListList extends Base implements \Countable, \ArrayAccess, \Iterator
throw new \Exception(sprintf('%s:Unknown object type: %s',self::LOGKEY,$type));
}
$this->startPosition = $response->QueryResponse->startPosition;
$this->maxResults = $response->QueryResponse->maxResults;
$this->startPosition = $response->startPosition;
$this->maxResults = $response->maxResults;
return $data;
}