Skip to content

Commit 879fc8f

Browse files
Merge pull request #39 from i-doit/release-1.0.1
Release 1.0.1
2 parents 986a51a + e4ce1cb commit 879fc8f

5 files changed

Lines changed: 28 additions & 14 deletions

File tree

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ jobs:
2020
- '8.2'
2121
- '8.3'
2222
experimental: [false]
23-
include:
24-
- php-versions: nightly
25-
experimental: true
23+
#include:
24+
# - php-versions: nightly
25+
# experimental: true
2626
steps:
2727
- name: Checkout repository
2828
uses: actions/checkout@v2

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased][]
99

10+
## [1.0.1][] – 2024-12-17
11+
12+
**Note:** For the next minor version (1.1.0) we plan to drop support for PHP `8.0`.
13+
14+
### Fixed
15+
16+
- `Request::requireSuccessFor()`: Fix misleading error response for (successfully) saving category data when using `CMDBCategory`
17+
18+
### Changed
19+
20+
- Slightly updating the README to represent the current state of the client (PHP and i-doit compatibility)
21+
1022
## [1.0.0][] – 2024-12-16
1123

1224
**Note:** Support for all PHP `7` versions has been dropped. PHP `8+` only, from now on :)
@@ -233,7 +245,8 @@ Happy summer time ⛱️
233245

234246
Initial release
235247

236-
[Unreleased]: https://github.com/i-doit/api-client-php/compare/1.0.0...HEAD
248+
[Unreleased]: https://github.com/i-doit/api-client-php/compare/1.0.1...HEAD
249+
[1.0.1]: https://github.com/i-doit/api-client-php/compare/1.0.0...1.0.1
237250
[1.0.0]: https://github.com/i-doit/api-client-php/compare/0.10...1.0.0
238251
[0.10]: https://github.com/i-doit/api-client-php/compare/0.9...0.10
239252
[0.9]: https://github.com/i-doit/api-client-php/compare/0.8...0.9

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Easy-to-use, but feature-rich client library for i-doit's JSON-RPC API
44

55
[![Latest stable version](https://img.shields.io/packagist/v/idoit/apiclient.svg)](https://packagist.org/packages/idoit/apiclient)
6-
[![Minimum PHP version](https://img.shields.io/badge/php-%3E%3D%207.4-8892BF.svg)](https://php.net/)
6+
[![Minimum PHP version](https://img.shields.io/badge/php-%3E%3D%208.0-8892BF.svg)](https://php.net/)
77
[![Build status](https://github.com/i-doit/api-client-php/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/i-doit/api-client-php/actions)
88

99
**Please note: This project is not an official product by synetics GmbH. synetics GmbH doesn't provide any commercial support.**
@@ -39,9 +39,9 @@ What's new? Take a look at the [changelog](CHANGELOG.md).
3939

4040
Meet these simple requirements before using the client:
4141

42-
- A running instance of i-doit pro/open, version `1.18.1` or higher (older versions may work but are not supported)
43-
- i-doit API add-on, version `1.12.3` or higher (older versions may work but are not supported)
44-
- PHP, version `8.0` or higher (`8.1` is recommended, `7.4` should work but is deprecated)
42+
- A running instance of i-doit pro/open, version `30` or higher (older versions may work but are not supported)
43+
- i-doit API add-on, version `2.0` or higher (older versions may work but are not supported)
44+
- PHP, version `8.0` or higher (`8.2` is recommended)
4545
- PHP modules `curl`, `date`, `json`, `openssl` and `zlib`
4646

4747
As a rule of thumb, always use the latest stable releases to benefit from new features, improvements and bug fixes.

src/CMDBCategory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ public function batchCreate(array $objectIDs, string $categoryConst, array $attr
401401
}
402402
}
403403

404-
$entryIDs[] = (int) $entry['id'];
404+
$entryIDs[] = (int) ($entry['id'] ?? $entry['entry']);
405405
}
406406

407407
return $entryIDs;

src/Request.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,19 @@ public function __construct(API $api) {
6161
* @throws RuntimeException on error
6262
*/
6363
protected function requireSuccessFor(array $result): int {
64-
if (!array_key_exists('id', $result) ||
65-
!is_numeric($result['id']) ||
66-
!array_key_exists('success', $result) ||
67-
$result['success'] !== true) {
64+
$idExists = array_key_exists('id', $result) || array_key_exists('entry', $result);
65+
$idIsNumeric = is_numeric($result['id'] ?? $result['entry'] ?? null);
66+
$isSuccess = array_key_exists('success', $result) && $result['success'] === true;
67+
68+
if (!$idExists || !$idIsNumeric || !$isSuccess) {
6869
if (array_key_exists('message', $result)) {
6970
throw new RuntimeException(sprintf('Bad result: %s', $result['message']));
7071
} else {
7172
throw new RuntimeException('Bad result');
7273
}
7374
}
7475

75-
return (int) $result['id'];
76+
return (int) ($result['id'] ?? $result['entry']);
7677
}
7778

7879
/**

0 commit comments

Comments
 (0)