-
Notifications
You must be signed in to change notification settings - Fork 215
/
Copy pathTickets.php
60 lines (50 loc) · 1.75 KB
/
Tickets.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
57
58
59
60
<?php
declare(strict_types=1);
namespace Auth0\SDK\API\Management;
use Auth0\SDK\Contract\API\Management\TicketsInterface;
use Auth0\SDK\Utility\Request\RequestOptions;
use Auth0\SDK\Utility\Toolkit;
use Psr\Http\Message\ResponseInterface;
/**
* Handles requests to the Tickets endpoint of the v2 Management API.
*
* @see https://auth0.com/docs/api/management/v2#!/Tickets
*/
final class Tickets extends ManagementEndpoint implements TicketsInterface
{
public function createEmailVerification(
string $userId,
?array $body = null,
?RequestOptions $options = null,
): ResponseInterface {
[$userId] = Toolkit::filter([$userId])->string()->trim();
[$body] = Toolkit::filter([$body])->array()->trim();
Toolkit::assert([
[$userId, \Auth0\SDK\Exception\ArgumentException::missing('userId')],
])->isString();
/** @var array<mixed> $body */
return $this->getHttpClient()
->method('post')->addPath(['tickets', 'email-verification'])
->withBody(
(object) Toolkit::merge([[
'user_id' => $userId,
], $body]),
)
->withOptions($options)
->call();
}
public function createPasswordChange(
array $body,
?RequestOptions $options = null,
): ResponseInterface {
[$body] = Toolkit::filter([$body])->array()->trim();
Toolkit::assert([
[$body, \Auth0\SDK\Exception\ArgumentException::missing('body')],
])->isArray();
return $this->getHttpClient()
->method('post')->addPath(['tickets', 'password-change'])
->withBody((object) $body)
->withOptions($options)
->call();
}
}