blob: c06b1180ae3b3e19f83604fb4f56a28ce9797c2c (
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
|
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\AppFramework\Http\Attribute;
/**
* Attribute for controller methods that want to limit the times a logged-in
* user can call the endpoint in a given time period.
*
* @since 27.0.0
*/
abstract class ARateLimit {
/**
* @param int $limit The maximum number of requests that can be made in the given period in seconds.
* @param int $period The time period in seconds.
* @since 27.0.0
*/
public function __construct(
protected int $limit,
protected int $period,
) {
}
/**
* @since 27.0.0
*/
public function getLimit(): int {
return $this->limit;
}
/**
* @since 27.0.0
*/
public function getPeriod(): int {
return $this->period;
}
}
|