AI code review: fix bugs, rename sld to subdomain, improve usability (#2)

- bug fixes: API errors are no longer wrapped into "Unexpected error!",
  zoneGet no longer crashes on unknown zones, getSubdomain handles apex
  and multi-level names, batch operations send the full record name,
  list methods fetch all pages, recordDelete handles empty results
- rename "sld" to "subdomain": getSubdomain(), recordCreateSubdomain(),
  old methods deprecated; "@" (CfDnsClient.APEX) addresses the apex
- one shared HTTP client with connection pooling, CfDnsClient
  implements AutoCloseable
- CloudflareApiException provides HTTP status code and Cloudflare
  errors, HTTP 404 throws CloudflareNotFoundException
- RecordEntity supports priority, data, comment and tags
- recordCreate/recordUpdate send only writable attributes and don't
  modify the given record
- breaking: recordList overloads replaced by recordListBySubdomain and
  recordListByType, timestamps are java.time.Instant
- single record type is filtered server-side (?type=)
- tests, README and changelog updated

refs #2

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
thischwaandClaude Opus 5.5 committed 2026-11-03 15:44:25 +01:00
1 parent 4b560141a1
commit 732f92ee78
22 files changed
+1256 -336

No files matched your search

+24
View File
@@ -1,10 +1,34 @@
# Changelog
- 0.6.0-SNAPSHOT:
- **Breaking Changes**:
- `recordList` overloads replaced, because they were ambiguous (e.g. `recordList(zone, null)` didn't compile):
- `recordList(zone, String subdomain, RecordType... types)` and `recordList(zone, String subdomain)` → `recordListBySubdomain(zone, subdomain, types...)`
- `recordList(zone, RecordType... types)` → `recordListByType(zone, types...)`
- `recordList(zone)` and `recordList(zone, PagingRequest)` remain unchanged
- timestamps of `RecordEntity` and `ZoneEntity` (`createdOn`, `modifiedOn`, `activatedOn`) are of type `java.time.Instant` instead of `LocalDateTime`, so the time zone (UTC) isn't lost anymore
- Cloudflare responses with HTTP status 404 throw a `CloudflareNotFoundException` (independent of `emptyResultThrowsException`)
- unexpected runtime exceptions aren't wrapped into a `CloudflareApiException("Unexpected error!")` anymore
- batch DELETE sends only the record IDs, batch PATCH sends all writable attributes which aren't `null` (before: only the content)
- `CfDnsClient` uses one shared HTTP client with connection pooling instead of a new one per request and implements `AutoCloseable`, call `close()` to release the connections
- `CloudflareApiException` provides the HTTP status code (`getStatusCode()`) and the errors reported by Cloudflare (`getErrors()`)
- `RecordEntity` supports the attributes `priority` (MX, SRV, URI), `data` (e.g. SRV, CAA), `comment` and `tags`; they are also considered by batch operations, as is `proxied`
- `recordCreate` and `recordUpdate` don't modify the given `RecordEntity` anymore and send only writable attributes
- fluent `update(content)` sends only the new content (partial update)
- filtering by exactly one record type is done by Cloudflare (`?type=`), unknown record types in responses don't break the client-side filter anymore
- updated dependencies: jackson 3.2.4, httpclient5 5.6.4, lombok 1.18.48, logback-classic 1.6.6, mockito-junit-jupiter 5.24.0
- updated maven plugins: maven-compiler-plugin 3.16.0, maven-surefire-plugin 3.6.0, maven-jar-plugin 3.5.1
- README: fixed fluent API examples, documented paging and further methods
- fixed "getRecord" wording in javadoc, log and exception messages (e.g. "Invalid record type")
- **Deprecation**: the misleading term "sld" was renamed to "subdomain", the old methods will be removed in a future release:
- `RecordEntity#getSld()` → `RecordEntity#getSubdomain()`
- `CfDnsClient#recordCreateSld(...)` → `CfDnsClient#recordCreateSubdomain(...)`
- `getSubdomain()` returns `"@"` for the zone apex; `CfDnsClient.APEX` can be used to address the zone apex
- fixed: API errors were wrapped into a generic "Unexpected error!" exception
- fixed: `zoneGet` threw an `IndexOutOfBoundsException` for unknown zones, it now returns `null` or throws a `CloudflareNotFoundException` (depending on `emptyResultThrowsException`)
- fixed: `getSubdomain()` failed for apex records and records with multi-level subdomains, batch operations now send the full record name
- fixed: `zoneList()` and `recordList(...)` without `PagingRequest` returned only the first page, now all pages are fetched
- fixed: `recordDelete` threw a `NullPointerException` for an empty result
- 0.5.0:
- moved the project to git.mein-gateway.de
- replaced sonarqube with own actions