aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/DirectEditing/IToken.php
blob: 53a67883f540e91fed2a81682fcdefa749ea0a6f (plain)
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
61
62
63
64
<?php
/**
 * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */
namespace OCP\DirectEditing;

use OCP\Files\File;
use OCP\Files\NotFoundException;

/**
 * @since 18.0.0
 */
interface IToken {
	/**
	 * Extend the token validity time
	 *
	 * @since 18.0.0
	 */
	public function extend(): void;

	/**
	 * Invalidate the token
	 *
	 * @since 18.0.0
	 */
	public function invalidate(): void;

	/**
	 * Check if the token has already been used
	 *
	 * @since 18.0.0
	 * @return bool
	 */
	public function hasBeenAccessed(): bool;

	/**
	 * Change to the user scope of the token
	 *
	 * @since 18.0.0
	 */
	public function useTokenScope(): void;

	/**
	 * Get the file that is related to the token
	 *
	 * @since 18.0.0
	 * @return File
	 * @throws NotFoundException
	 */
	public function getFile(): File;

	/**
	 * @since 18.0.0
	 * @return string
	 */
	public function getEditor(): string;

	/**
	 * @since 18.0.0
	 * @return string
	 */
	public function getUser(): string;
}