Skip to content

Commit 39e83db

Browse files
committed
Added UPGRADE.md
1 parent 0c24ffc commit 39e83db

File tree

3 files changed

+82
-20
lines changed

3 files changed

+82
-20
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
77
#### Changed
88

99
* Update nette libs to version 3.0.0 (BC break)
10+
* Added typehints (BC break)
1011
* Pretty JSON output in API console - without escaping unicode and slashes
1112
* Replaced handler information array triplet (endpoint, handler, authorization) with Api
1213

UPGRADE.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# UPGRADE
2+
3+
## Upgrade from 1.x to 2.0.0
4+
5+
### Removed support for old PHP versions
6+
New version not supported PHP versions 5.6 and 7.0 and also hhvm. Please use it with newer versions of PHP (>7.1)
7+
8+
### Updated dependencies
9+
Version 2.0.0 requires nette packages in version 3.0, so probably you will have to upgrade whole your nette application
10+
11+
### Typehints
12+
There are some breaking changes because of typehints:
13+
14+
#### ApiAuthorizationInterface
15+
Add typehints to methods:
16+
- `authorized(): bool`
17+
- `getErrorMessage(): ?string`
18+
19+
#### ApiHandlerInterface
20+
Add typehints to methods:
21+
- `params(): array`
22+
- `handle(array $params): Tomaj\NetteApi\Response\ResponseInterface`
23+
24+
#### ApiLoggerInterface
25+
Add typehints to method:
26+
- `log(int $responseCode, string $requestMethod, string $requestHeader, string $requestUri, string $requestIp, string $requestAgent, int $responseTime): bool`
27+
28+
#### BearerTokenRepositoryInterface
29+
Add typehints to methods:
30+
- `validToken(string $token): bool`
31+
- `ipRestrictions(string $token): ?string`
32+
33+
#### IpDetectorInterface
34+
Add typehints to method:
35+
- `getRequestIp(): string`
36+
37+
#### ParamInterface
38+
Add typehints to methods:
39+
- `isValid(): bool`
40+
- `getKey(): string`
41+
42+
#### EndpointInterface
43+
Add typehints to methods:
44+
- `getMethod(): string`
45+
- `getVersion(): int`
46+
- `getPackage(): string`
47+
- `getApiAction(): ?string`
48+
- `getUrl(): string`
49+
50+
### Renamed methods
51+
Few methods have been renamed, please use their new versions:
52+
- `ApiDecider::addApiHandler()` -> `ApiDecider::addApi()`
53+
- `ApiDecider::getApiHandler()` -> `ApiDecider::getApi()`
54+
- `ApiDecider::getHandlers()` -> `ApiDecider::getApis()`
55+
56+
### Final methods
57+
BaseHandler now have few final methods:
58+
- `setEndpointIdentifier`
59+
- `getEndpoint`
60+
- `setupLinkGenerator`
61+
- `createLink`
62+
63+
### Removed params
64+
Parameters $parent and $name have been removed from ApiListingControl. New usage is:
65+
```
66+
new ApiListingControl($apiDecider)
67+
```
68+
69+
### Changed params
70+
Some parameters were strictly typed:
71+
- second parameter in `JsonApiResponse::__construct` (`$payload` formerly known as `$data`) is now `array`
72+
- fifth parameter in `JsonApiResponse::__construct` (`$expiration`) is now `DateTimeInteface` or `null`
73+
- fourth parameter in `InputParam::__construc` (`$availableValues`) is now `array` or `null`

src/Logger/ApiLoggerInterface.php

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,13 @@
44

55
interface ApiLoggerInterface
66
{
7-
/**
8-
* Log processed api request
9-
*
10-
* @param integer $responseCode
11-
* @param string $requestMethod
12-
* @param string $requestHeader
13-
* @param string $requestUri
14-
* @param string $requestIp
15-
* @param string $requestAgent
16-
* @param integer $responseTime
17-
* @return boolean
18-
*/
197
public function log(
20-
$responseCode,
21-
$requestMethod,
22-
$requestHeader,
23-
$requestUri,
24-
$requestIp,
25-
$requestAgent,
26-
$responseTime
27-
);
8+
int $responseCode,
9+
string $requestMethod,
10+
string $requestHeader,
11+
string $requestUri,
12+
string $requestIp,
13+
string $requestAgent,
14+
int $responseTime
15+
): bool;
2816
}

0 commit comments

Comments
 (0)