-
Notifications
You must be signed in to change notification settings - Fork 215
/
Copy pathBlacklists.php
56 lines (48 loc) · 1.58 KB
/
Blacklists.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
declare(strict_types=1);
namespace Auth0\SDK\API\Management;
use Auth0\SDK\Contract\API\Management\BlacklistsInterface;
use Auth0\SDK\Utility\Request\RequestOptions;
use Auth0\SDK\Utility\Toolkit;
use Psr\Http\Message\ResponseInterface;
/**
* Handles requests to the Blacklists endpoint of the v2 Management API.
*
* @see https://auth0.com/docs/api/management/v2#!/Blacklists
*/
final class Blacklists extends ManagementEndpoint implements BlacklistsInterface
{
public function create(
string $jti,
?string $aud = null,
?RequestOptions $options = null,
): ResponseInterface {
[$jti, $aud] = Toolkit::filter([$jti, $aud])->string()->trim();
Toolkit::assert([
[$jti, \Auth0\SDK\Exception\ArgumentException::missing('jti')],
])->isString();
return $this->getHttpClient()
->method('post')->addPath(['blacklists', 'tokens'])
->withBody(
(object) Toolkit::filter([
[
'jti' => $jti,
'aud' => $aud,
],
])->array()->trim()[0],
)
->withOptions($options)
->call();
}
public function get(
?string $aud = null,
?RequestOptions $options = null,
): ResponseInterface {
[$aud] = Toolkit::filter([$aud])->string()->trim();
return $this->getHttpClient()
->method('get')->addPath(['blacklists', 'tokens'])
->withParam('aud', $aud)
->withOptions($options)
->call();
}
}