-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMethod.php
32 lines (29 loc) · 954 Bytes
/
Method.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
<?php
namespace Barnslig\Jmap\Core;
/**
* Interface to implement a JMAP method
*
* Methods are what is actually called during a Request. They process the input
* given as an Invocation and return the Invocation where arguments are
* replaced by the return values.
*/
interface Method
{
/**
* Validate a response
*
* @param Invocation $request Request invocation
* @param RequestContext $context JMAP request context
* @throws \Barnslig\Jmap\Core\Schemas\ValidationException When the validation has failed
* @return void
*/
public static function validate(Invocation $request, RequestContext $context): void;
/**
* Invoke the method
*
* @param Invocation $request Request invocation
* @param RequestContext $context JMAP request context
* @return Invocation Response invocation
*/
public function handle(Invocation $request, RequestContext $context): Invocation;
}