chore: ignore Junie session data
Build and Analyse / build-and-analyse (push) Successful in 1m29s

Align pagination with Cloudflare API limits

Co-authored-by: Junie <junie@jetbrains.com>
This commit is contained in:
thischwaandJunie committed 2026-11-06 13:38:51 +01:00
1 parent 7aab2e9610
commit 369c584f5f
11 files changed
+185 -62

No files matched your search

+12 -2
View File
@@ -95,12 +95,17 @@ List<ZoneEntity> zones = cfDnsClient.zoneList();
zones.forEach(zone -> System.out.println("Zone: " + zone.getName()));
```
By default, up to 1000 zones are fetched in a single request. Use a `PagingRequest` to control paging:
Without a `PagingRequest`, `zoneList()` fetches zones in pages of 50, requesting further pages as needed.
Use a `PagingRequest` to retrieve a specific page:
```java
List<ZoneEntity> zones = cfDnsClient.zoneList(PagingRequest.of(1, 50)); // page 1, 50 zones per page
```
Page numbers start at 1. Cloudflare accepts page sizes from 5 to 50 for zones and from 1 to 5,000,000
for DNS records. `PagingRequest.defaultPaging()` requests page 1 with 50 items; it does not fetch
additional pages.
---
### `zoneGet`
@@ -163,7 +168,8 @@ List<RecordEntity> allZoneRecords = cfDnsClient.recordList(zone);
List<RecordEntity> pagedRecords = cfDnsClient.recordList(zone, PagingRequest.of(2, 100));
```
Without a `PagingRequest`, all pages are fetched and the complete result is returned.
Without a `PagingRequest`, all pages are fetched using up to 5,000,000 records per page and combined into one result.
This large page size can consume substantial memory. If paging remains inconsistent after three attempts, the client logs a warning and may return an incomplete list. Use a smaller `PagingRequest` to retrieve one page at a time; further pages must be requested explicitly.
With a `PagingRequest`, exactly the requested page is returned.
`RecordEntity#getSubdomain()` returns the record name relative to its zone, e.g. `my.sub` for
@@ -273,6 +279,8 @@ cfDnsClient.recordDeleteTypeIfExists(zone, "api", RecordType.A, RecordType.AAAA)
System.out.println("Deletion attempt completed.");
```
If no record types are specified, records of all types for the subdomain are selected. Each record deletion is attempted independently: a `CloudflareApiException` from one deletion is logged and later records are still processed. No per-record result is returned, so a normal return does not guarantee that every selected record was deleted. Errors while retrieving the records are still reported; no matching records are treated as a no-op.
### Batch Operations
Process multiple DNS record operations (POST, PUT, PATCH, DELETE) in a single batch request.
@@ -425,6 +433,8 @@ client.zone("example.com")
.delete(RecordType.A, RecordType.AAAA);
```
The types passed to `delete` determine which record types are selected; a type filter passed to `getRecord` does not restrict deletion. Calling `delete()` without type arguments selects all record types for that subdomain. A `CloudflareApiException` from an individual deletion is logged and does not stop later attempts; no per-record result is returned.
### Advantages of Fluent API
- **More Readable**: The chain of method calls reads like natural language