Skip to content

Commit 5d33f61

Browse files
committed
fix codestyle + added logs endpoints + missing user blocks endpoints
1 parent fcb9bfd commit 5d33f61

File tree

10 files changed

+168
-83
lines changed

10 files changed

+168
-83
lines changed

src/API/Management.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Auth0\SDK\API\Management\DeviceCredentials;
99
use Auth0\SDK\API\Management\Emails;
1010
use Auth0\SDK\API\Management\Jobs;
11+
use Auth0\SDK\API\Management\Logs;
1112
use Auth0\SDK\API\Management\Rules;
1213
use Auth0\SDK\API\Management\Stats;
1314
use Auth0\SDK\API\Management\Tenants;
@@ -32,6 +33,7 @@ class Management {
3233
public $deviceCredentials;
3334
public $emails;
3435
public $jobs;
36+
public $logs;
3537
public $rules;
3638
public $stats;
3739
public $tenants;
@@ -53,6 +55,7 @@ public function __construct($token, $domain, $guzzleOptions = []) {
5355
$this->deviceCredentials = new DeviceCredentials($this->apiClient);
5456
$this->emails = new Emails($this->apiClient);
5557
$this->jobs = new Jobs($this->apiClient);
58+
$this->logs = new Logs($this->apiClient);
5659
$this->rules = new Rules($this->apiClient);
5760
$this->stats = new Stats($this->apiClient);
5861
$this->tenants = new Tenants($this->apiClient);

src/API/Management/Blacklists.php

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

8-
class Blacklists extends GenericResource {
9-
8+
class Blacklists extends GenericResource
9+
{
1010
public function getAll($aud)
1111
{
1212
return $this->apiClient->get()

src/API/Management/ClientGrants.php

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

8-
class ClientGrants extends GenericResource {
9-
8+
class ClientGrants extends GenericResource
9+
{
1010
public function get($id, $audience = null)
1111
{
1212
$request = $this->apiClient->get()
@@ -34,7 +34,7 @@ public function create($client_id, $audience, $scope)
3434
return $request->call();
3535
}
3636

37-
public function get($id, $audience = null)
37+
public function delete($id, $audience = null)
3838
{
3939
return $this->apiClient->delete()
4040
->addPath('client-grants', $id)
@@ -52,5 +52,4 @@ public function update($id, $scope)
5252

5353
return $request->call();
5454
}
55-
5655
}

src/API/Management/Clients.php

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

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

15-
if ($fields !== null) {
16-
if (is_array($fields)) {
15+
if ($fields !== null)
16+
{
17+
if (is_array($fields))
18+
{
1719
$fields = implode(',', $fields);
1820
}
1921
$request->withParam('fields', $fields);
2022
}
21-
if ($include_fields !== null) {
23+
24+
if ($include_fields !== null)
25+
{
2226
$request->withParam('include_fields', $include_fields);
2327
}
2428

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

28-
public function get($id, $fields = null, $include_fields = null) {
29-
32+
public function get($id, $fields = null, $include_fields = null)
33+
{
3034
$request = $this->apiClient->get()
3135
->clients($id);
3236

33-
if ($fields !== null) {
34-
if (is_array($fields)) {
37+
if ($fields !== null)
38+
{
39+
if (is_array($fields))
40+
{
3541
$fields = implode(',', $fields);
3642
}
3743
$request->withParam('fields', $fields);
3844
}
39-
if ($include_fields !== null) {
45+
if ($include_fields !== null)
46+
{
4047
$request->withParam('include_fields', $include_fields);
4148
}
4249

4350
return $request->call();
4451
}
4552

46-
public function delete($id) {
47-
53+
public function delete($id)
54+
{
4855
return $this->apiClient->delete()
4956
->clients($id)
5057
->call();
5158
}
5259

53-
public function create($data) {
54-
60+
public function create($data)
61+
{
5562
return $this->apiClient->post()
5663
->clients()
5764
->withHeader(new ContentType('application/json'))
5865
->withBody(json_encode($data))
5966
->call();
6067
}
6168

62-
public function update($id, $data) {
63-
69+
public function update($id, $data)
70+
{
6471
return $this->apiClient->patch()
6572
->clients($id)
6673
->withHeader(new ContentType('application/json'))

src/API/Management/Connections.php

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

8-
class Connections extends GenericResource {
9-
10-
public function getAll($strategy = null, $fields = null, $include_fields = null) {
11-
8+
class Connections extends GenericResource
9+
{
10+
public function getAll($strategy = null, $fields = null, $include_fields = null)
11+
{
1212
$request = $this->apiClient->get()
1313
->connections();
1414

15-
if ($strategy !== null) {
15+
if ($strategy !== null)
16+
{
1617
$request->withParam('strategy', $strategy);
1718
}
18-
if ($fields !== null) {
19-
if (is_array($fields)) {
19+
20+
if ($fields !== null)
21+
{
22+
if (is_array($fields))
23+
{
2024
$fields = implode(',', $fields);
2125
}
2226
$request->withParam('fields', $fields);
2327
}
24-
if ($include_fields !== null) {
28+
29+
if ($include_fields !== null)
30+
{
2531
$request->withParam('include_fields', $include_fields);
2632
}
2733

2834
return $request->call();
2935
}
3036

31-
public function get($id, $fields = null, $include_fields = null) {
32-
37+
public function get($id, $fields = null, $include_fields = null)
38+
{
3339
$request = $this->apiClient->get()
3440
->connections($id);
3541

36-
if ($fields !== null) {
37-
if (is_array($fields)) {
42+
if ($fields !== null)
43+
{
44+
if (is_array($fields))
45+
{
3846
$fields = implode(',', $fields);
3947
}
4048
$request->withParam('fields', $fields);
4149
}
42-
if ($include_fields !== null) {
50+
51+
if ($include_fields !== null)
52+
{
4353
$request->withParam('include_fields', $include_fields);
4454
}
4555

4656
return $request->call();
4757
}
4858

49-
public function delete($id) {
50-
59+
public function delete($id)
60+
{
5161
return $this->apiClient->delete()
5262
->connections($id)
5363
->call();
5464
}
5565

56-
public function deleteUser($id, $email) {
57-
66+
public function deleteUser($id, $email)
67+
{
5868
return $this->apiClient->delete()
5969
->connections($id)
6070
->users()
6171
->withParam('email', $email)
6272
->call();
6373
}
6474

65-
public function create($data) {
66-
75+
public function create($data)
76+
{
6777
return $this->apiClient->post()
6878
->connections()
6979
->withHeader(new ContentType('application/json'))
7080
->withBody(json_encode($data))
7181
->call();
7282
}
7383

74-
public function update($id, $data) {
75-
84+
public function update($id, $data)
85+
{
7686
return $this->apiClient->patch()
7787
->connections($id)
7888
->withHeader(new ContentType('application/json'))

src/API/Management/DeviceCredentials.php

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

8-
class DeviceCredentials extends GenericResource {
9-
8+
class DeviceCredentials extends GenericResource
9+
{
1010
const TYPE_PUBLIC_KEY = 'public_key';
1111
const TYPE_REFESH_TOKEN = 'refresh_token';
1212

13-
public function getAll($user_id = null, $client_id = null, $type = null, $fields = null, $include_fields = null) {
14-
13+
public function getAll($user_id = null, $client_id = null, $type = null, $fields = null, $include_fields = null)
14+
{
1515
$request = $this->apiClient->get()
1616
->addPath('device-credentials');
1717

18-
if ($fields !== null) {
19-
if (is_array($fields)) {
18+
if ($fields !== null)
19+
{
20+
if (is_array($fields))
21+
{
2022
$fields = implode(',', $fields);
2123
}
2224
$request->withParam('fields', $fields);
2325
}
24-
if ($include_fields !== null) {
26+
27+
if ($include_fields !== null)
28+
{
2529
$request->withParam('include_fields', $include_fields);
2630
}
27-
if ($user_id !== null) {
31+
32+
if ($user_id !== null)
33+
{
2834
$request->withParam('user_id', $user_id);
2935
}
30-
if ($client_id !== null) {
36+
37+
if ($client_id !== null)
38+
{
3139
$request->withParam('client_id', $client_id);
3240
}
33-
if ($type !== null) {
41+
42+
if ($type !== null)
43+
{
3444
$request->withParam('type', $type);
3545
}
3646

3747
return $request->call();
3848
}
3949

40-
public function createPublicKey($data) {
41-
50+
public function createPublicKey($data)
51+
{
4252
return $this->apiClient->post()
4353
->addPath('device-credentials')
4454
->withHeader(new ContentType('application/json'))
4555
->withBody(json_encode($data))
4656
->call();
4757
}
4858

49-
public function deleteDeviceCredential($id) {
50-
59+
public function deleteDeviceCredential($id)
60+
{
5161
return $this->apiClient->delete()
5262
->addPath('device-credentials', $id)
5363
->call();

src/API/Management/Logs.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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 Logs extends GenericResource
9+
{
10+
public function get($id)
11+
{
12+
$request = $this->apiClient->get()
13+
->logs($id);
14+
15+
return $request->call();
16+
}
17+
18+
public function search($params = array()) {
19+
20+
$client = $this->apiClient->get()
21+
->logs();
22+
23+
foreach ($params as $param => $value) {
24+
$client->withParam($param, $value);
25+
}
26+
27+
return $client->call();
28+
}
29+
}

0 commit comments

Comments
 (0)