1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Cerbero\LazyJsonPages\Data; |
6
|
|
|
|
7
|
|
|
use Cerbero\LazyJsonPages\Paginations\Pagination; |
8
|
|
|
use Cerbero\LazyJsonPages\Services\RateLimits; |
9
|
|
|
use Closure; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* The configuration |
13
|
|
|
* |
14
|
|
|
* @property-read class-string<Pagination> $pagination |
15
|
|
|
*/ |
|
|
|
|
16
|
|
|
final class Config |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* The configuration options. |
20
|
|
|
*/ |
21
|
|
|
public const OPTION_PAGE_NAME = 'pageName'; |
22
|
|
|
public const OPTION_PAGE_IN_PATH = 'pageInPath'; |
23
|
|
|
public const OPTION_FIRST_PAGE = 'firstPage'; |
24
|
|
|
public const OPTION_TOTAL_PAGES_KEY = 'totalPagesKey'; |
25
|
|
|
public const OPTION_TOTAL_ITEMS_KEY = 'totalItemsKey'; |
26
|
|
|
public const OPTION_CURSOR_KEY = 'cursorKey'; |
27
|
|
|
public const OPTION_LAST_PAGE_KEY = 'lastPageKey'; |
28
|
|
|
public const OPTION_OFFSET_KEY = 'offsetKey'; |
29
|
|
|
public const OPTION_HAS_LINK_HEADER = 'hasLinkHeader'; |
30
|
|
|
public const OPTION_PAGINATION = 'pagination'; |
31
|
|
|
public const OPTION_RATE_LIMITS = 'rateLimits'; |
32
|
|
|
public const OPTION_ASYNC = 'async'; |
33
|
|
|
public const OPTION_ATTEMPTS = 'attempts'; |
34
|
|
|
public const OPTION_BACKOFF = 'backoff'; |
35
|
|
|
public const OPTION_ITEMS_POINTER = 'itemsPointer'; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Instantiate the class. |
39
|
|
|
*/ |
40
|
50 |
|
public function __construct( |
41
|
|
|
public readonly string $itemsPointer, |
42
|
|
|
public readonly string $pageName = 'page', |
43
|
|
|
public readonly int $firstPage = 1, |
44
|
|
|
public readonly ?string $pageInPath = null, |
45
|
|
|
public readonly ?string $totalPagesKey = null, |
46
|
|
|
public readonly ?string $totalItemsKey = null, |
47
|
|
|
public readonly ?string $cursorKey = null, |
48
|
|
|
public readonly ?string $lastPageKey = null, |
49
|
|
|
public readonly ?string $offsetKey = null, |
50
|
|
|
public readonly bool $hasLinkHeader = false, |
51
|
|
|
public readonly ?string $pagination = null, |
52
|
|
|
public readonly ?RateLimits $rateLimits = null, |
53
|
|
|
public readonly int $async = 1, |
54
|
|
|
public readonly int $attempts = 3, |
55
|
|
|
public readonly ?Closure $backoff = null, |
56
|
50 |
|
) {} |
57
|
|
|
} |
58
|
|
|
|