Skip to content

Commit

Permalink
Merge pull request #91 from jbdabes/master
Browse files Browse the repository at this point in the history
update to include @AndrewGatenbyVS changes
  • Loading branch information
jbdabes authored May 22, 2019
2 parents 73cab75 + 9149201 commit 573ea61
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions src/Api/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function __construct(Client $client, $onlineIdOrProfileObject = '')
/**
* Gets online ID.
*
* @return void
* @return string
*/
public function onlineId() : string
{
Expand Down Expand Up @@ -133,11 +133,11 @@ public function avatarUrl() : string
}

/**
* Gets the User psnuid.
* Gets the User accountId.
*
* @return string
*/
public function psnuid() : string
public function accountId() : string
{
return $this->info()->accountId;
}
Expand Down Expand Up @@ -282,14 +282,7 @@ public function games($limit = 100) : array
{
$returnGames = [];

$games = $this->get(sprintf(Game::GAME_ENDPOINT . 'users/%s/titles', $this->onlineIdParameter()), [
'type' => 'played',
'app' => 'richProfile', // ??
'sort' => '-lastPlayedDate',
'limit' => $limit,
'iw' => 240, // Size of game image width
'ih' => 240 // Size of game image height
]);
$games = $this->fetchPlayedGames($limit);

if ($games->size === 0) return $returnGames;

Expand All @@ -300,6 +293,22 @@ public function games($limit = 100) : array
return $returnGames;
}

/**
* @param int $limit
* @return
*/
public function fetchPlayedGames($limit)
{
return $this->get(sprintf(Game::GAME_ENDPOINT . 'users/%s/titles', $this->onlineIdParameter()), [
'type' => 'played',
'app' => 'richProfile', // ??
'sort' => '-lastPlayedDate',
'limit' => $limit,
'iw' => 240, // Size of game image width
'ih' => 240 // Size of game image height
]);
}

/**
* Send a Message to the User.
*
Expand Down

0 comments on commit 573ea61

Please sign in to comment.