1
0
Fork 0
mirror of synced 2024-06-29 19:50:26 +12:00

getUser and related, temp, respond empty

This commit is contained in:
wess 2022-03-11 09:09:48 -05:00
parent 5d5a7b88e0
commit 7d66e995c3

View file

@ -164,12 +164,6 @@ class Notion extends OAuth2
*/
public function getUserEmail(string $accessToken):string
{
$response = $this->getUser($accessToken);
if(isset($response['bot']['owner']['user']['person']['email'])){
return $response['bot']['owner']['user']['person']['email'];
}
return '';
}
@ -180,12 +174,6 @@ class Notion extends OAuth2
*/
public function getUserName(string $accessToken):string
{
$response = $this->getUser($accessToken);
if (isset($response['bot']['owner']['user']['name'])) {
return $response['bot']['owner']['user']['name'];
}
return '';
}
@ -196,15 +184,6 @@ class Notion extends OAuth2
*/
protected function getUser(string $accessToken)
{
$headers = [
'Notion-Version: ' . $this->version,
'Authorization: Bearer '.\urlencode($accessToken)
];
if (empty($this->user)) {
$this->user = \json_decode($this->request('GET', $this->endpoint . '/users/me', $headers), true);
}
return $this->user;
}
}