10 defined(
'JPATH_PLATFORM') or die;
30 public function getUser($user)
33 $path =
'/users/' . $user;
36 $response = $this->client->get($this->fetchUrl($path));
39 if ($response->code != 200)
42 $error = json_decode($response->body);
43 throw new DomainException($error->message, $response->code);
46 return json_decode($response->body);
56 public function getAuthenticatedUser()
62 $response = $this->client->get($this->fetchUrl($path));
65 if ($response->code != 200)
68 $error = json_decode($response->body);
69 throw new DomainException($error->message, $response->code);
72 return json_decode($response->body);
90 public function updateUser($name =
'', $email =
'', $blog =
'', $company =
'', $location =
'', $hireable =
'', $bio =
'')
96 'company' => $company,
97 'location' => $location,
98 'hireable' => $hireable,
106 $response = $this->client->patch($this->fetchUrl($path), json_encode($data));
109 if ($response->code != 200)
112 $error = json_decode($response->body);
113 throw new DomainException($error->message, $response->code);
116 return json_decode($response->body);
129 public function getUsers($since = 0)
134 $path .= ($since) ?
'?since=' . $since :
'';
137 $response = $this->client->get($this->fetchUrl($path));
140 if ($response->code != 200)
143 $error = json_decode($response->body);
144 throw new DomainException($error->message, $response->code);
147 return json_decode($response->body);