Skip to content

Commit db88330

Browse files
committed
codestyle + added resource servers endpoints
1 parent 1afd24e commit db88330

File tree

6 files changed

+87
-36
lines changed

6 files changed

+87
-36
lines changed

src/API/Management.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class Management {
3535
public $jobs;
3636
public $logs;
3737
public $rules;
38+
public $resource_servers;
3839
public $stats;
3940
public $tenants;
4041
public $tickets;
@@ -57,6 +58,7 @@ public function __construct($token, $domain, $guzzleOptions = []) {
5758
$this->jobs = new Jobs($this->apiClient);
5859
$this->logs = new Logs($this->apiClient);
5960
$this->rules = new Rules($this->apiClient);
61+
$this->resource_servers = new ResourceServers($this->apiClient);
6062
$this->stats = new Stats($this->apiClient);
6163
$this->tenants = new Tenants($this->apiClient);
6264
$this->tickets = new Tickets($this->apiClient);

src/API/Management/ClientGrants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function delete($id, $audience = null)
4343

4444
public function update($id, $scope)
4545
{
46-
$request = $this->apiClient->post()
46+
$request = $this->apiClient->patch()
4747
->addPath('client-grants', $id)
4848
->withHeader(new ContentType('application/json'))
4949
->withBody(json_encode([
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
namespace Auth0\SDK\API\Management;
4+
5+
use Auth0\SDK\API\Helpers\ApiClient;
6+
use Auth0\SDK\API\Header\ContentType;
7+
8+
class ResourceServers extends GenericResource
9+
{
10+
public function get($id)
11+
{
12+
return $this->apiClient->get()
13+
->addPath('resource-servers', $id)
14+
->call();
15+
}
16+
17+
public function create($client_id, $data)
18+
{
19+
$request = $this->apiClient->post()
20+
->addPath('resource-servers')
21+
->withHeader(new ContentType('application/json'))
22+
->withBody(json_encode( $data ));
23+
24+
return $request->call();
25+
}
26+
27+
public function delete($id)
28+
{
29+
return $this->apiClient->delete()
30+
->addPath('resource-servers', $id)
31+
->call()
32+
}
33+
34+
public function update($id, $data)
35+
{
36+
$request = $this->apiClient->patch()
37+
->addPath('resource-servers', $id)
38+
->withHeader(new ContentType('application/json'))
39+
->withBody(json_encode( $data ));
40+
41+
return $request->call();
42+
}
43+
}

src/API/Management/Stats.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
use Auth0\SDK\API\Helpers\ApiClient;
66
use Auth0\SDK\API\Header\ContentType;
77

8-
class Stats extends GenericResource {
9-
10-
public function getActiveUsersCount() {
11-
8+
class Stats extends GenericResource
9+
{
10+
public function getActiveUsersCount()
11+
{
1212
return $this->apiClient->get()
1313
->stats()
1414
->addPath('active-users')
1515
->call();
1616
}
1717

18-
public function getDailyStats($from, $to) {
19-
18+
public function getDailyStats($from, $to)
19+
{
2020
return $this->apiClient->get()
2121
->stats()
2222
->daily()

src/API/Management/Tenants.php

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,36 @@
55
use Auth0\SDK\API\Helpers\ApiClient;
66
use Auth0\SDK\API\Header\ContentType;
77

8-
class Tenants extends GenericResource {
9-
10-
public function get($fields = null, $include_fields = null) {
11-
8+
class Tenants extends GenericResource
9+
{
10+
public function get($fields = null, $include_fields = null)
11+
{
1212
$request = $this->apiClient->get()
1313
->tenants()
1414
->settings();
1515

16-
if ($fields !== null) {
17-
if (is_array($fields)) {
16+
if ($fields !== null)
17+
{
18+
if (is_array($fields))
19+
{
1820
$fields = implode(',', $fields);
1921
}
2022
$request->withParam('fields', $fields);
2123
}
22-
if ($include_fields !== null) {
24+
25+
if ($include_fields !== null)
26+
{
2327
$request->withParam('include_fields', $include_fields);
2428
}
2529

2630
return $request->call();
2731
}
2832

29-
public function update($data) {
30-
33+
public function update($data)
34+
{
3135
return $this->apiClient->patch()
3236
->tenants()
3337
->settings()
3438
->call();
3539
}
36-
3740
}

src/API/Management/Tickets.php

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
use Auth0\SDK\API\Helpers\ApiClient;
66
use Auth0\SDK\API\Header\ContentType;
77

8-
class Tickets extends GenericResource {
9-
10-
public function createEmailVerificationTicket($user_id, $result_url = null) {
11-
8+
class Tickets extends GenericResource
9+
{
10+
public function createEmailVerificationTicket($user_id, $result_url = null)
11+
{
1212
$body = array('user_id' => $user_id);
1313
if ($result_url !== null) {
1414
$body['result_url'] = $result_url;
@@ -24,35 +24,38 @@ public function createEmailVerificationTicket($user_id, $result_url = null) {
2424

2525
}
2626

27-
public function createPasswordChangeTicket($user_id, $new_password = null, $result_url = null, $connection_id = null) {
28-
29-
return $this->createPasswordChangeTicketRaw($user_id, null, $new_password, $result_url, $connection_id);
30-
27+
public function createPasswordChangeTicket($user_id, $new_password = null, $result_url = null, $connection_id = null)
28+
{
29+
return $this->createPasswordChangeTicketRaw($user_id, null, $new_password, $result_url, $connection_id);
3130
}
3231

33-
public function createPasswordChangeTicketByEmail($email, $new_password = null, $result_url = null, $connection_id = null) {
34-
35-
return $this->createPasswordChangeTicketRaw(null, $mail, $new_password, $result_url, $connection_id);
36-
32+
public function createPasswordChangeTicketByEmail($email, $new_password = null, $result_url = null, $connection_id = null)
33+
{
34+
return $this->createPasswordChangeTicketRaw(null, $mail, $new_password, $result_url, $connection_id);
3735
}
3836

39-
public function createPasswordChangeTicketRaw($user_id = null, $email = null, $new_password = null, $result_url = null, $connection_id = null) {
40-
37+
public function createPasswordChangeTicketRaw($user_id = null, $email = null, $new_password = null, $result_url = null, $connection_id = null)
38+
{
4139
$body = [];
4240

43-
if ($user_id) {
41+
if ($user_id)
42+
{
4443
$body['user_id'] = $user_id;
4544
}
46-
if ($email) {
45+
if ($email)
46+
{
4747
$body['email'] = $email;
4848
}
49-
if ($new_password) {
49+
if ($new_password)
50+
{
5051
$body['new_password'] = $new_password;
5152
}
52-
if ($result_url) {
53+
if ($result_url)
54+
{
5355
$body['result_url'] = $result_url;
5456
}
55-
if ($connection_id) {
57+
if ($connection_id)
58+
{
5659
$body['connection_id'] = $connection_id;
5760
}
5861

0 commit comments

Comments
 (0)