Skip to content

Commit

Permalink
Add getProfilePick method
Browse files Browse the repository at this point in the history
  • Loading branch information
donhardman committed Jun 16, 2021
1 parent 18f1d0d commit 144595f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/NodeAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,18 @@ public function getProfile(string $search, string $type = 'username'): array {
return [null, $result['Profile']];
}

public function getProfilePic(string $pubkey): string {
$old_rt = $this->request_type;
$this->request_type = 'raw';
[$err, $result] = $this->run('get-single-profile-picture/' . $pubkey, [], 'GET');
$this->request_type = $old_rt;

if ($err) {
return '';
}
return 'data:image/webp;base64,' . base64_encode($result);
}

public function getProfiles(string $search, string $type = 'username', int $limit = 20, string $order = 'newest', string $moderation = 'unrestricted'): array {
return $this->run('get-profiles', [
'PublicKeyBase58Check' => $type === 'pubkey' ? $search : '',
Expand Down

0 comments on commit 144595f

Please sign in to comment.