code clean-up and api stream-lining #9

Closed
opened 2026-01-05 17:40:50 +01:00 by Ghost · 7 comments
Ghost commented 2026-01-05 17:40:50 +01:00 (Migrated from codeberg.org)
No description provided.
Ghost commented 2026-01-05 17:40:50 +01:00 (Migrated from codeberg.org)

assigned to @th-schwarz

assigned to @th-schwarz
Ghost commented 2026-01-06 13:19:45 +01:00 (Migrated from codeberg.org)

mentioned in commit a221de4792

mentioned in commit a221de4792a56fb25f7c6bd14fa52493f0058233
Ghost commented 2026-01-06 15:43:23 +01:00 (Migrated from codeberg.org)

1. API Method Naming Consistency

  • Renamed methods for consistency:
    • zoneListAll()zoneList()
    • zoneInfo()zoneGet()
    • sldListAll()recordList()
    • sldInfo()recordGet()
  • Updated all tests and documentation

2. Code Duplication Reduction

  • Extracted helper methods in recordBatch() for cleaning and processing batch records
  • Made deleteRequest() and patchRequest() type-safe by accepting responseType parameter
  • Improved type safety in HTTP operations

3. Code Simplifications

  • Renamed RecordEntity methods for clarity:
    • getName()getSld() method
  • Replaced magic number in PagingRequest.defaultPaging() with named constant DEFAULT_ALL_RECORDS_PAGE_SIZE

4. Fluent API Implementation - NEW FEATURE

  • Created fluent API package with interfaces:
    • ZoneOperations - zone-level operations
    • RecordOperations - record-level operations
    • ZoneOperationsImpl and RecordOperationsImpl - public implementations
  • Added zone(String zoneName) entry point to CfDnsClient
  • Enables chainable syntax: client.zone("example.com").record("api").create(...)

5. Empty Result Exception Handling - BREAKING CHANGE

  • Changed emptyResultThrowsException default from true to false
  • Extended functionality to cover both single and multiple results
  • Added validation for AbstractSingleResponse (checks for null result)

Breaking Changes

  1. API method renames (backward compatibility via @Deprecated methods where applicable)
  2. emptyResultThrowsException default changed from true to false
  3. RecordEntity.getName() → `getSld()
### 1. **API Method Naming Consistency** - Renamed methods for consistency: - `zoneListAll()` → `zoneList()` - `zoneInfo()` → `zoneGet()` - `sldListAll()` → `recordList()` - `sldInfo()` → `recordGet()` - Updated all tests and documentation ### 2. **Code Duplication Reduction** - Extracted helper methods in `recordBatch()` for cleaning and processing batch records - Made `deleteRequest()` and `patchRequest()` type-safe by accepting `responseType` parameter - Improved type safety in HTTP operations ### 3. **Code Simplifications** - Renamed `RecordEntity` methods for clarity: - `getName()` → `getSld()` method - Replaced magic number in `PagingRequest.defaultPaging()` with named constant `DEFAULT_ALL_RECORDS_PAGE_SIZE` ### 4. **Fluent API Implementation** - NEW FEATURE - Created fluent API package with interfaces: - `ZoneOperations` - zone-level operations - `RecordOperations` - record-level operations - `ZoneOperationsImpl` and `RecordOperationsImpl` - public implementations - Added `zone(String zoneName)` entry point to `CfDnsClient` - Enables chainable syntax: `client.zone("example.com").record("api").create(...)` ### 5. **Empty Result Exception Handling** - BREAKING CHANGE - Changed `emptyResultThrowsException` default from `true` to `false` - Extended functionality to cover both single and multiple results - Added validation for `AbstractSingleResponse` (checks for null result) ### Breaking Changes 1. API method renames (backward compatibility via `@Deprecated` methods where applicable) 2. `emptyResultThrowsException` default changed from `true` to `false` 3. `RecordEntity.getName()` → `getSld()
Ghost commented 2026-01-06 20:14:10 +01:00 (Migrated from codeberg.org)

mentioned in commit acf2a2fc3b

mentioned in commit acf2a2fc3b577b186bb920880763bf9d4f11567e
Ghost commented 2026-01-06 20:35:54 +01:00 (Migrated from codeberg.org)

mentioned in commit 0f1248d08b

mentioned in commit 0f1248d08b7d9624ae456bf77cca58473303d6f9
Ghost commented 2026-01-07 17:52:52 +01:00 (Migrated from codeberg.org)

mentioned in commit 34010a4e77

mentioned in commit 34010a4e773ed9234d8d469d45f66f0b658f31b6
Ghost commented 2026-01-11 18:28:26 +01:00 (Migrated from codeberg.org)

mentioned in commit b241d8cf09

mentioned in commit b241d8cf091855b3c6918d91f95ebca7528ab626
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: thischwa/CloudflareDNS-java#9