From 82e4c18b1a17f6a5060356132814be9e2be12194 Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 25 Jun 2019 22:21:09 +0200 Subject: [PATCH] Added readme and license file --- LICENSE | 5 ++++ README.md | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 LICENSE create mode 100644 README.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3928db3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,5 @@ + - KloudflareAPI - + https://git.dorkbox.com/dorkbox/KloudflareAPI + Copyright 2019 - The Apache Software License, Version 2.0 + Dorkbox LLC + Cloudflare API v4 for Kotlin diff --git a/README.md b/README.md new file mode 100644 index 0000000..1229303 --- /dev/null +++ b/README.md @@ -0,0 +1,72 @@ +KloudflareAPI +======= + +###### [![Dorkbox](https://badge.dorkbox.com/dorkbox.svg "Dorkbox")](https://git.dorkbox.com/dorkbox/KloudflareAPI) [![Github](https://badge.dorkbox.com/github.svg "Github")](https://github.com/dorkbox/KloudflareAPI) [![Gitlab](https://badge.dorkbox.com/gitlab.svg "Gitlab")](https://gitlab.com/dorkbox/KloudflareAPI) [![Bitbucket](https://badge.dorkbox.com/bitbucket.svg "Bitbucket")](https://bitbucket.org/dorkbox/KloudflareAPI) + + +KloudflareAPI is an kotlin project that implements (some of) the Cloudflare v4 API, allowing one manage DNS zones and user information + +Pull requests are welcome! + +- This is for cross-platform use, specifically - linux 32/64, mac 64, and windows 32/64. Java 8+ + +``` java +val email = "test@example.com" +val token = "ac1d3f45b51cc5d23e47aa4ac7c07b54d60f2" + +val kloudflare = Kloudflare(email, token) +println(kloudflare.getUser()) + +val listZones = kloudflare.listZones() +listZones.forEach { zone -> + println("${zone.name} : ${zone.id}") + + val dnsRecords = kloudflare.listDnsRecords(zone) + dnsRecords.forEach { dnsRecord -> + if (dnsRecord.type == RecordType.A || dnsRecord.type == RecordType.AAAA) { + val domainLength = zone.name.length + val length = dnsRecord.name.length - domainLength + + val domainName = if (length == 0) { + "@" + } + else { + // -1 because we don't want the '.' + dnsRecord.name.subSequence(0, length - 1) + } + + println(" $domainName ${dnsRecord.type} : ${dnsRecord.id}") + } + } +} +``` + +  +  + +Maven Info +--------- +``` + + ... + + com.dorkbox + KloudflareAPI + 1.0 + + +``` + +Gradle Info +--------- +```` +dependencies { + ... + compile 'com.dorkbox:KloudflareAPI:1.0' +} +```` + +License +--------- +This project is © 2019 dorkbox llc, and is distributed under the terms of the Apache v2.0 License. See file "LICENSE" for further references. +