From 25fd480e69daad50ef6c8567cca777e3baf1273d Mon Sep 17 00:00:00 2001 From: Thilo Schwarz Date: Tue, 6 Jan 2026 14:35:25 +0100 Subject: [PATCH] Standardize and simplify `README` code examples by eliminating unnecessary line continuations, improving readability, and enhancing method chaining for DNS operations. --- README.md | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 6f812f9..b98e247 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,12 @@ List records = cfDnsClient.recordList(zone, "sld"); records. forEach(record -> - System.out.println("Record Type: " + record.getType() + ", Value: " + record.getContent()) + System.out. + +println("Record Type: "+record.getType() + +", Value: "+record. + +getContent()) ); ``` @@ -469,9 +474,11 @@ RecordEntity updated = client.zone("example.com") // Delete DNS records client. -zone("example.com"). +zone("example.com") + . -record("old-service"). +record("old-service") + . delete(RecordType.A, RecordType.AAAA); ``` @@ -491,9 +498,11 @@ CfDnsClient client = new CfDnsClient("email@example.com", "yourApiKey"); // Create a new record client. -zone("example.com"). +zone("example.com") + . -record("api"). +record("api") + . create(RecordType.A, "192.168.100.1",60); @@ -510,25 +519,29 @@ getContent()); // Update the record client. -zone("example.com"). +zone("example.com") + . -record("api",RecordType.A). +record("api",RecordType.A) + . update("192.168.100.2"); // Clean up client. -zone("example.com"). +zone("example.com") + . -record("api"). +record("api") + . delete(RecordType.A); ``` --- -### Notes on Error Handling +# Notes on Error Handling The `CfDnsClient` provides internal error-handling mechanisms through exceptions. For example: - `CloudflareApiException` is thrown for errors during API communication or invalid responses. @@ -542,7 +555,7 @@ To enable exception throwing for empty results: CfDnsClient client = new CfDnsClient(true, "email@example.com", "yourApiKey"); ``` -#### Example: +## Example: ```java try { @@ -564,7 +577,7 @@ getContent()); --- -### Summary +# Summary `CfDnsClient` offers a simple interface for managing DNS entries via Cloudflare's public API, allowing seamless CRUD operations and automation-friendly workflows. \ No newline at end of file