Updated API to use Moshi CodeGen instead of reflection for creating JSON serialization adapters

This commit is contained in:
nathan 2020-01-06 11:36:12 +01:00
parent f2fa258f78
commit 3c9f36911e
33 changed files with 349 additions and 239 deletions

View File

@ -16,10 +16,12 @@
package dorkbox.kloudflareApi.api.core package dorkbox.kloudflareApi.api.core
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
/** /**
* Date fields will always be in UTC ISO-8601 format, including microseconds. * Date fields will always be in UTC ISO-8601 format, including microseconds.
*/ */
@JsonClass(generateAdapter = true)
open class CfErrorResponse { open class CfErrorResponse {
// HTTP response codes // HTTP response codes
//200 OK request successful //200 OK request successful
@ -32,16 +34,16 @@ open class CfErrorResponse {
//415 Unsupported Media Type response is not valid JSON //415 Unsupported Media Type response is not valid JSON
@field:[Json(name = "success")] @field:[Json(name = "success")]
val success = false var success = false
@field:[Json(name = "errors")] @field:[Json(name = "errors")]
val errors = listOf<Error>() var errors = listOf<Error>()
@field:[Json(name = "messages")] @field:[Json(name = "messages")]
val messages = listOf<String>() var messages = listOf<String>()
@field:[Json(name = "result_info")] @field:[Json(name = "result_info")]
val resultInfo: ResultInfo? = null var resultInfo: ResultInfo? = null
override fun toString(): String { override fun toString(): String {
return "Response(success=$success, errors=$errors, messages=$messages, resultInfo=$resultInfo)" return "Response(success=$success, errors=$errors, messages=$messages, resultInfo=$resultInfo)"

View File

@ -16,10 +16,12 @@
package dorkbox.kloudflareApi.api.core package dorkbox.kloudflareApi.api.core
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
/** /**
* Date fields will always be in UTC ISO-8601 format, including microseconds. * Date fields will always be in UTC ISO-8601 format, including microseconds.
*/ */
@JsonClass(generateAdapter = true)
open class CfResponse<T> { open class CfResponse<T> {
// HTTP response codes // HTTP response codes
//200 OK request successful //200 OK request successful
@ -35,19 +37,19 @@ open class CfResponse<T> {
* The data requested is wrapped in the result tag. If you have a response, it will always be within the result field * The data requested is wrapped in the result tag. If you have a response, it will always be within the result field
*/ */
@field:[Json(name = "result")] @field:[Json(name = "result")]
val result: T? = null var result: T? = null
@field:[Json(name = "success")] @field:[Json(name = "success")]
val success = false var success = false
@field:[Json(name = "errors")] @field:[Json(name = "errors")]
val errors = listOf<Error>() var errors = listOf<Error>()
@field:[Json(name = "messages")] @field:[Json(name = "messages")]
val messages = listOf<String>() var messages = listOf<String>()
@field:[Json(name = "result_info")] @field:[Json(name = "result_info")]
val resultInfo: ResultInfo? = null var resultInfo: ResultInfo? = null
override fun toString(): String { override fun toString(): String {
return "Response(result=$result, success=$success, errors=$errors, messages=$messages, resultInfo=$resultInfo)" return "Response(result=$result, success=$success, errors=$errors, messages=$messages, resultInfo=$resultInfo)"

View File

@ -16,11 +16,13 @@
package dorkbox.kloudflareApi.api.core package dorkbox.kloudflareApi.api.core
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
class Error { class Error {
@field:[Json(name = "code")] @field:[Json(name = "code")]
val code = 0 var code = 0
@field:[Json(name = "message")] @field:[Json(name = "message")]
val message = "" var message = ""
} }

View File

@ -16,19 +16,21 @@
package dorkbox.kloudflareApi.api.core package dorkbox.kloudflareApi.api.core
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
class ResultInfo { class ResultInfo {
@field:[Json(name = "page")] @field:[Json(name = "page")]
val page = 1 var page = 1
@field:[Json(name = "per_page")] @field:[Json(name = "per_page")]
val perPage = 20 var perPage = 20
@field:[Json(name = "count")] @field:[Json(name = "count")]
val count = 1 var count = 1
@field:[Json(name = "total_count")] @field:[Json(name = "total_count")]
val totalCount = 200 var totalCount = 200
override fun toString(): String { override fun toString(): String {
return "ResultInfo(page=$page, perPage=$perPage, count=$count, totalCount=$totalCount)" return "ResultInfo(page=$page, perPage=$perPage, count=$count, totalCount=$totalCount)"

View File

@ -16,23 +16,19 @@
package dorkbox.kloudflareApi.api.dns package dorkbox.kloudflareApi.api.dns
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import dorkbox.kloudflareApi.api.zone.Zone import dorkbox.kloudflareApi.api.zone.Zone
/** /**
* https://api.cloudflare.com/#dns-records-for-a-zone-create-dns-record * https://api.cloudflare.com/#dns-records-for-a-zone-create-dns-record
*
* NOTE: 'zone' is not part of the Cloudflare API
*
* It is used to associate this dns record with it's zone.
* A default value is required by code generation.
*/ */
open class CreateDnsRecord(zone: Zone) { @JsonClass(generateAdapter = true)
open class CreateDnsRecord(@Transient val zone: Zone = Zone()) {
/**
* NOTE: This is not part of the Cloudflare API
*
* Used to associate this dns record with it's zone
*/
@Transient
val zone = zone
/** /**
* Record type * Record type

View File

@ -16,10 +16,12 @@
package dorkbox.kloudflareApi.api.dns package dorkbox.kloudflareApi.api.dns
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
/** /**
* https://api.cloudflare.com/#dns-records-for-a-zone-delete-dns-record * https://api.cloudflare.com/#dns-records-for-a-zone-delete-dns-record
*/ */
@JsonClass(generateAdapter = true)
open class DeleteDnsRecord { open class DeleteDnsRecord {
/** /**
* DNS record identifier tag * DNS record identifier tag

View File

@ -16,6 +16,7 @@
package dorkbox.kloudflareApi.api.dns package dorkbox.kloudflareApi.api.dns
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import dorkbox.kloudflareApi.api.core.ISO8601 import dorkbox.kloudflareApi.api.core.ISO8601
import dorkbox.kloudflareApi.api.zone.Zone import dorkbox.kloudflareApi.api.zone.Zone
import java.time.LocalDateTime import java.time.LocalDateTime
@ -23,6 +24,7 @@ import java.time.LocalDateTime
/** /**
* https://api.cloudflare.com/#dns-records-for-a-zone-properties * https://api.cloudflare.com/#dns-records-for-a-zone-properties
*/ */
@JsonClass(generateAdapter = true)
open class DnsRecord { open class DnsRecord {
/** /**
* NOTE: This is not part of the Cloudflare API * NOTE: This is not part of the Cloudflare API
@ -105,13 +107,13 @@ open class DnsRecord {
* When the record was last modified * When the record was last modified
*/ */
@field:[Json(name = "modified_on") ISO8601] @field:[Json(name = "modified_on") ISO8601]
var modifiedOn = LocalDateTime.now() var modifiedOn: LocalDateTime = LocalDateTime.now()
/** /**
* When the record was created * When the record was created
*/ */
@field:[Json(name = "created_on") ISO8601] @field:[Json(name = "created_on") ISO8601]
var createdOn = LocalDateTime.now() var createdOn: LocalDateTime = LocalDateTime.now()
/** /**
* Extra Cloudflare-specific information about the record * Extra Cloudflare-specific information about the record

View File

@ -16,19 +16,21 @@
package dorkbox.kloudflareApi.api.dns package dorkbox.kloudflareApi.api.dns
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
/** /**
* https://api.cloudflare.com/#dns-records-for-a-zone-properties * https://api.cloudflare.com/#dns-records-for-a-zone-properties
*/ */
@JsonClass(generateAdapter = true)
class Meta { class Meta {
/** /**
* Will exist if Cloudflare automatically added this DNS record during initial setup. * Will exist if Cloudflare automatically added this DNS record during initial setup.
*/ */
@field:[Json(name = "auto_added")] @field:[Json(name = "auto_added")]
val autoAdded = false var autoAdded = false
@field:[Json(name = "managed_by_apps")] @field:[Json(name = "managed_by_apps")]
val managedByApps = false var managedByApps = false
} }

View File

@ -16,11 +16,19 @@
package dorkbox.kloudflareApi.api.dns package dorkbox.kloudflareApi.api.dns
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import dorkbox.kloudflareApi.api.zone.Zone
/** /**
* https://api.cloudflare.com/#dns-records-for-a-zone-update-dns-record * https://api.cloudflare.com/#dns-records-for-a-zone-update-dns-record
*
* NOTE: 'dnsRecord' is not part of the Cloudflare API
*
* It is used to associate this dns record with it's zone and id.
* A default value is required by code generation.
*/ */
class UpdateDnsRecord(dnsRecord: DnsRecord) : CreateDnsRecord(dnsRecord.zone) { @JsonClass(generateAdapter = true)
class UpdateDnsRecord(@Transient val dnsRecord: DnsRecord = DnsRecord()) : CreateDnsRecord(dnsRecord.zone) {
/** /**
* DNS record identifier tag * DNS record identifier tag

View File

@ -16,25 +16,27 @@
package dorkbox.kloudflareApi.api.firewall package dorkbox.kloudflareApi.api.firewall
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import dorkbox.kloudflareApi.api.core.ISO8601 import dorkbox.kloudflareApi.api.core.ISO8601
import java.time.LocalDateTime import java.time.LocalDateTime
/** /**
* https://api.cloudflare.com/#user-level-firewall-access-rule-properties * https://api.cloudflare.com/#user-level-firewall-access-rule-properties
*/ */
@JsonClass(generateAdapter = true)
class AccessRule { class AccessRule {
/** /**
* Access rule identifier tag * Access rule identifier tag
*/ */
@field:[Json(name = "id")] @field:[Json(name = "id")]
val id = "" var id = ""
/** /**
* A personal note about the rule. Typically used as a reminder or explanation for the rule. * A personal note about the rule. Typically used as a reminder or explanation for the rule.
*/ */
@field:[Json(name = "notes")] @field:[Json(name = "notes")]
val notes = "" var notes = ""
/** /**
* The possible modes the rule can be in. * The possible modes the rule can be in.
@ -42,7 +44,7 @@ class AccessRule {
* valid values: block, challenge, whitelist, js_challenge * valid values: block, challenge, whitelist, js_challenge
*/ */
@field:[Json(name = "allowed_modes")] @field:[Json(name = "allowed_modes")]
val allowedModes = listOf<String>() var allowedModes = listOf<String>()
/** /**
* The action to apply to a matched request * The action to apply to a matched request
@ -50,28 +52,28 @@ class AccessRule {
* valid values: block, challenge, whitelist, js_challenge * valid values: block, challenge, whitelist, js_challenge
*/ */
@field:[Json(name = "mode")] @field:[Json(name = "mode")]
val mode = "" var mode = ""
/** /**
* Rule configuration * Rule configuration
*/ */
@field:[Json(name = "configuration")] @field:[Json(name = "configuration")]
val configuration = Configuration() var configuration = Configuration()
@field:[Json(name = "scope")] @field:[Json(name = "scope")]
val scope = Scope() var scope = Scope()
/** /**
* When the record was last modified * When the record was last modified
*/ */
@field:[Json(name = "modified_on") ISO8601] @field:[Json(name = "modified_on") ISO8601]
var modifiedOn = LocalDateTime.now() var modifiedOn: LocalDateTime = LocalDateTime.now()
/** /**
* When the record was created * When the record was created
*/ */
@field:[Json(name = "created_on") ISO8601] @field:[Json(name = "created_on") ISO8601]
var createdOn = LocalDateTime.now() var createdOn: LocalDateTime = LocalDateTime.now()
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
if (this === other) return true if (this === other) return true

View File

@ -16,10 +16,12 @@
package dorkbox.kloudflareApi.api.firewall package dorkbox.kloudflareApi.api.firewall
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
/** /**
* https://api.cloudflare.com/#user-level-firewall-access-rule-properties * https://api.cloudflare.com/#user-level-firewall-access-rule-properties
*/ */
@JsonClass(generateAdapter = true)
class Configuration { class Configuration {
/** /**
@ -29,7 +31,7 @@ class Configuration {
* *
*/ */
@field:[Json(name = "target")] @field:[Json(name = "target")]
val target = "" var target = ""
/** /**
@ -39,7 +41,7 @@ class Configuration {
* COUNTRY : US, DE, etc * COUNTRY : US, DE, etc
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "" var value = ""
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
if (this === other) return true if (this === other) return true

View File

@ -16,23 +16,25 @@
package dorkbox.kloudflareApi.api.firewall package dorkbox.kloudflareApi.api.firewall
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
/** /**
* https://api.cloudflare.com/#user-level-firewall-access-rule-properties * https://api.cloudflare.com/#user-level-firewall-access-rule-properties
*/ */
@JsonClass(generateAdapter = true)
class Scope { class Scope {
/** /**
* User identifier tag * User identifier tag
*/ */
@field:[Json(name = "id")] @field:[Json(name = "id")]
val id = "" var id = ""
/** /**
* Your contact email address * Your contact email address
*/ */
@field:[Json(name = "email")] @field:[Json(name = "email")]
val email = "" var email = ""
/** /**
@ -41,7 +43,7 @@ class Scope {
* valid values: user * valid values: user
*/ */
@field:[Json(name = "type")] @field:[Json(name = "type")]
val type = "user" var type = "user"
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
if (this === other) return true if (this === other) return true

View File

@ -16,6 +16,7 @@
package dorkbox.kloudflareApi.api.user package dorkbox.kloudflareApi.api.user
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import dorkbox.kloudflareApi.api.core.ISO8601 import dorkbox.kloudflareApi.api.core.ISO8601
import dorkbox.kloudflareApi.api.zone.Zone import dorkbox.kloudflareApi.api.zone.Zone
import java.time.LocalDateTime import java.time.LocalDateTime
@ -23,55 +24,56 @@ import java.time.LocalDateTime
/** /**
* https://api.cloudflare.com/#user-billing-history-billing-history * https://api.cloudflare.com/#user-billing-history-billing-history
*/ */
@JsonClass(generateAdapter = true)
class BillingHistory { class BillingHistory {
/** /**
* Billing item identifier tag * Billing item identifier tag
*/ */
@field:[Json(name = "id")] @field:[Json(name = "id")]
val id = "" var id = ""
/** /**
* The billing item type * The billing item type
*/ */
@field:[Json(name = "type")] @field:[Json(name = "type")]
val type = "charge" var type = "charge"
/** /**
* The billing item action * The billing item action
*/ */
@field:[Json(name = "action")] @field:[Json(name = "action")]
val action = "subscription" var action = "subscription"
/** /**
* The billing item description * The billing item description
*/ */
@field:[Json(name = "description")] @field:[Json(name = "description")]
val description = "The billing item description" var description = "The billing item description"
/** /**
* When the billing item was created * When the billing item was created
*/ */
@field:[Json(name = "occurred_at") ISO8601] @field:[Json(name = "occurred_at") ISO8601]
val occurredAt= LocalDateTime.now() var occurredAt: LocalDateTime = LocalDateTime.now()
/** /**
* The amount associated with this billing item * The amount associated with this billing item
*/ */
@field:[Json(name = "amount")] @field:[Json(name = "amount")]
val amount: Double = 20.99 var amount: Double = 20.99
/** /**
* The monetary unit in which pricing information is displayed * The monetary unit in which pricing information is displayed
*/ */
@field:[Json(name = "currency")] @field:[Json(name = "currency")]
val currency = "USD" var currency = "USD"
/** /**
* *
*/ */
@field:[Json(name = "zone")] @field:[Json(name = "zone")]
val zone = Zone() var zone = Zone()
override fun toString(): String { override fun toString(): String {
return "BillingHistory(id='$id', type='$type', action='$action', description='$description', occurredAt=$occurredAt, amount=$amount, currency='$currency', zone=$zone)" return "BillingHistory(id='$id', type='$type', action='$action', description='$description', occurredAt=$occurredAt, amount=$amount, currency='$currency', zone=$zone)"

View File

@ -16,140 +16,142 @@
package dorkbox.kloudflareApi.api.user package dorkbox.kloudflareApi.api.user
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import dorkbox.kloudflareApi.api.core.ISO8601 import dorkbox.kloudflareApi.api.core.ISO8601
import java.time.LocalDateTime import java.time.LocalDateTime
/** /**
* https://api.cloudflare.com/#user-billing-profile-billing-profile * https://api.cloudflare.com/#user-billing-profile-billing-profile
*/ */
@JsonClass(generateAdapter = true)
class BillingProfile { class BillingProfile {
/** /**
* The email address associated with this payment type * The email address associated with this payment type
*/ */
@field:[Json(name = "payment_email")] @field:[Json(name = "payment_email")]
val paymentEmail = "" var paymentEmail = ""
/** /**
* Billing profile identifier tag * Billing profile identifier tag
*/ */
@field:[Json(name = "id")] @field:[Json(name = "id")]
val id = "" var id = ""
/** /**
* The first name on the billing profile * The first name on the billing profile
*/ */
@field:[Json(name = "first_name")] @field:[Json(name = "first_name")]
val firstName = "" var firstName = ""
/** /**
* The last name on the billing profile * The last name on the billing profile
*/ */
@field:[Json(name = "last_name")] @field:[Json(name = "last_name")]
val lastName = "" var lastName = ""
/** /**
* Street address on the billing profile * Street address on the billing profile
*/ */
@field:[Json(name = "address")] @field:[Json(name = "address")]
val address = "" var address = ""
/** /**
* Street address continued, apartment/suite, etc (optional) * Street address continued, apartment/suite, etc (optional)
*/ */
@field:[Json(name = "address2")] @field:[Json(name = "address2")]
val address2 = "" var address2 = ""
/** /**
* The company name on the billing profile * The company name on the billing profile
*/ */
@field:[Json(name = "company")] @field:[Json(name = "company")]
val company = "" var company = ""
/** /**
* The city on the billing profile * The city on the billing profile
*/ */
@field:[Json(name = "city")] @field:[Json(name = "city")]
val city = "" var city = ""
/** /**
* the state/province on the billing profile * the state/province on the billing profile
*/ */
@field:[Json(name = "state")] @field:[Json(name = "state")]
val state = "" var state = ""
/** /**
* The zipcode on the billing profile * The zipcode on the billing profile
*/ */
@field:[Json(name = "zipCode")] @field:[Json(name = "zipCode")]
val zipcode = "" var zipcode = ""
/** /**
* the country of the address on the billing profile * the country of the address on the billing profile
*/ */
@field:[Json(name = "country")] @field:[Json(name = "country")]
val country = "" var country = ""
/** /**
* The telephone associated with the billing profile * The telephone associated with the billing profile
*/ */
@field:[Json(name = "telephone")] @field:[Json(name = "telephone")]
val telephone = "" var telephone = ""
/** /**
* The last four digits of the credit card on file * The last four digits of the credit card on file
*/ */
@field:[Json(name = "card_number")] @field:[Json(name = "card_number")]
val cardNumber = "" var cardNumber = ""
/** /**
* The month number (1-12) of when the credit card on file expires * The month number (1-12) of when the credit card on file expires
*/ */
@field:[Json(name = "card_expiry_month")] @field:[Json(name = "card_expiry_month")]
val cardExpiryMonth = 1 var cardExpiryMonth = 1
/** /**
* The year when the credit card on file expires * The year when the credit card on file expires
*/ */
@field:[Json(name = "card_expiry_year")] @field:[Json(name = "card_expiry_year")]
val cardExpiryYear = 2020 var cardExpiryYear = 2020
/** /**
* Value Added Tax ID * varue Added Tax ID
*/ */
@field:[Json(name = "vat")] @field:[Json(name = "vat")]
val vat = "" var vat = ""
/** /**
* Information about a customer's device collected by client SDK * Information about a customer's device collected by client SDK
*/ */
@field:[Json(name = "device_data")] @field:[Json(name = "device_data")]
val deviceData = "" var deviceData = ""
/** /**
* The gateway which was used to tokenize the payment method * The gateway which was used to tokenize the payment method
* braintree, paypal * braintree, paypal
*/ */
@field:[Json(name = "payment_gateway")] @field:[Json(name = "payment_gateway")]
val paymentGateway = "" var paymentGateway = ""
/** /**
* The string returned by the client SDK to represent a payment method * The string returned by the client SDK to represent a payment method
*/ */
@field:[Json(name = "payment_nonce")] @field:[Json(name = "payment_nonce")]
val paymentNonce = "" var paymentNonce = ""
/** /**
* When the profile was last modified * When the profile was last modified
*/ */
@field:[Json(name = "edited_on") ISO8601] @field:[Json(name = "edited_on") ISO8601]
val editedOn = LocalDateTime.now() var editedOn: LocalDateTime = LocalDateTime.now()
/** /**
* When the profile was created * When the profile was created
*/ */
@field:[Json(name = "created_on") ISO8601] @field:[Json(name = "created_on") ISO8601]
val createdOn = LocalDateTime.now() var createdOn: LocalDateTime = LocalDateTime.now()
override fun toString(): String { override fun toString(): String {
return "BillingProfile(paymentEmail='$paymentEmail', id='$id', firstName='$firstName', lastName='$lastName', address='$address', address2='$address2', company='$company', city='$city', state='$state', zipcode='$zipcode', country='$country', telephone='$telephone', cardNumber='$cardNumber', cardExpiryMonth=$cardExpiryMonth, cardExpiryYear=$cardExpiryYear, vat='$vat', deviceData='$deviceData', paymentGateway='$paymentGateway', paymentNonce='$paymentNonce', editedOn=$editedOn, createdOn=$createdOn)" return "BillingProfile(paymentEmail='$paymentEmail', id='$id', firstName='$firstName', lastName='$lastName', address='$address', address2='$address2', company='$company', city='$city', state='$state', zipcode='$zipcode', country='$country', telephone='$telephone', cardNumber='$cardNumber', cardExpiryMonth=$cardExpiryMonth, cardExpiryYear=$cardExpiryYear, vat='$vat', deviceData='$deviceData', paymentGateway='$paymentGateway', paymentNonce='$paymentNonce', editedOn=$editedOn, createdOn=$createdOn)"

View File

@ -16,97 +16,99 @@
package dorkbox.kloudflareApi.api.user package dorkbox.kloudflareApi.api.user
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import dorkbox.kloudflareApi.api.core.ISO8601 import dorkbox.kloudflareApi.api.core.ISO8601
import java.time.LocalDateTime import java.time.LocalDateTime
/** /**
* https://api.cloudflare.com/#user-properties * https://api.cloudflare.com/#user-properties
*/ */
@JsonClass(generateAdapter = true)
class User { class User {
/** /**
* A list of betas the user is currently participating in. If a beta is zone-specific, the beta will apply to all zones. * A list of betas the user is currently participating in. If a beta is zone-specific, the beta will apply to all zones.
*/ */
@field:[Json(name = "betas")] @field:[Json(name = "betas")]
val betas = listOf<String>() var betas = listOf<String>()
/** /**
* A list of the organizations the user is a member of (or invited to) and the permissions granted to them. * A list of the organizations the user is a member of (or invited to) and the permissions granted to them.
*/ */
@field:[Json(name = "organizations")] @field:[Json(name = "organizations")]
val organizations = listOf<UserOrganization>() var organizations = listOf<UserOrganization>()
/** /**
* User's telephone number * User's telephone number
*/ */
@field:[Json(name = "telephone")] @field:[Json(name = "telephone")]
val telephone: String? = null var telephone: String? = null
/** /**
* The zipcode or postal code where the user lives. * The zipcode or postal code where the user lives.
*/ */
@field:[Json(name = "zipcode")] @field:[Json(name = "zipcode")]
val zipcode: String? = null var zipcode: String? = null
/** /**
* User's last name * User's last name
*/ */
@field:[Json(name = "last_name")] @field:[Json(name = "last_name")]
val lastName: String? = null var lastName: String? = null
/** /**
* Last time the user was modified * Last time the user was modified
*/ */
@field:[Json(name = "modified_on") ISO8601] @field:[Json(name = "modified_on") ISO8601]
val modifiedOn= LocalDateTime.now() var modifiedOn: LocalDateTime = LocalDateTime.now()
/** /**
* A username used to access other cloudflare services, like support * A username used to access other cloudflare services, like support
*/ */
@field:[Json(name = "username")] @field:[Json(name = "username")]
val userName = "" var userName = ""
/** /**
* When the user signed up. * When the user signed up.
*/ */
@field:[Json(name = "created_on") ISO8601] @field:[Json(name = "created_on") ISO8601]
val createdOn= LocalDateTime.now() var createdOn: LocalDateTime = LocalDateTime.now()
/** /**
* The country in which the user lives. * The country in which the user lives.
*/ */
@field:[Json(name = "country")] @field:[Json(name = "country")]
val country: String? = null var country: String? = null
/** /**
* Whether two-factor authentication is enabled for the user account. This does not apply to API authentication * Whether two-factor authentication is enabled for the user account. This does not apply to API authentication
*/ */
@field:[Json(name = "two_factor_authentication_enabled")] @field:[Json(name = "two_factor_authentication_enabled")]
val twoFactorAuthenticationEnabled = false var twoFactorAuthenticationEnabled = false
/** /**
* User's first name * User's first name
*/ */
@field:[Json(name = "first_name")] @field:[Json(name = "first_name")]
val firstName: String? = null var firstName: String? = null
/** /**
* User identifier tag * User identifier tag
*/ */
@field:[Json(name = "id")] @field:[Json(name = "id")]
val id = "" var id = ""
/** /**
* Indicates whether the user is prevented from performing certain actions within their account * Indicates whether the user is prevented from performing certain actions within their account
*/ */
@field:[Json(name = "suspended")] @field:[Json(name = "suspended")]
val suspended = false var suspended = false
/** /**
* Your contact email address * Your contact email address
*/ */
@field:[Json(name = "email")] @field:[Json(name = "email")]
val email = "" var email = ""
override fun toString(): String { override fun toString(): String {
return "User(betas=$betas, organizations=$organizations, telephone=$telephone, zipcode=$zipcode, lastName=$lastName, modifiedOn=$modifiedOn, userName='$userName', createdOn=$createdOn, country=$country, twoFactorAuthenticationEnabled=$twoFactorAuthenticationEnabled, firstName=$firstName, id='$id', suspended=$suspended, email='$email')" return "User(betas=$betas, organizations=$organizations, telephone=$telephone, zipcode=$zipcode, lastName=$lastName, modifiedOn=$modifiedOn, userName='$userName', createdOn=$createdOn, country=$country, twoFactorAuthenticationEnabled=$twoFactorAuthenticationEnabled, firstName=$firstName, id='$id', suspended=$suspended, email='$email')"

View File

@ -16,41 +16,43 @@
package dorkbox.kloudflareApi.api.user package dorkbox.kloudflareApi.api.user
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
/** /**
* https://api.cloudflare.com/#user-s-organizations-list-organizations * https://api.cloudflare.com/#user-s-organizations-list-organizations
*/ */
@JsonClass(generateAdapter = true)
class UserOrganization { class UserOrganization {
/** /**
* Organization identifier tag * Organization identifier tag
*/ */
@field:[Json(name = "id")] @field:[Json(name = "id")]
val id = "" var id = ""
/** /**
* Organization Name * Organization Name
*/ */
@field:[Json(name = "name")] @field:[Json(name = "name")]
val name = "" var name = ""
/** /**
* Whether or not the user is a member of the organization or has an inivitation pending * Whether or not the user is a member of the organization or has an invitation pending
*/ */
@field:[Json(name = "status")] @field:[Json(name = "status")]
val status = "" var status = ""
/** /**
* Access permissions for this User * Access permissions for this User
*/ */
@field:[Json(name = "permissions")] @field:[Json(name = "permissions")]
val permissions = listOf<String>() var permissions = listOf<String>()
/** /**
* List of role names for the User at the Organization * List of role names for the User at the Organization
*/ */
@field:[Json(name = "roles")] @field:[Json(name = "roles")]
val roles= listOf<String>() var roles= listOf<String>()
override fun toString(): String { override fun toString(): String {
return "UserOrganization(id='$id', name='$name', status='$status', permissions=$permissions, roles=$roles)" return "UserOrganization(id='$id', name='$name', status='$status', permissions=$permissions, roles=$roles)"

View File

@ -16,74 +16,76 @@
package dorkbox.kloudflareApi.api.user.invite package dorkbox.kloudflareApi.api.user.invite
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import dorkbox.kloudflareApi.api.core.ISO8601 import dorkbox.kloudflareApi.api.core.ISO8601
import java.time.LocalDateTime import java.time.LocalDateTime
/** /**
* https://api.cloudflare.com/#user-s-invites-properties * https://api.cloudflare.com/#user-s-invites-properties
*/ */
@JsonClass(generateAdapter = true)
class Invite { class Invite {
/** /**
* When the invite was sent * When the invite was sent
*/ */
@field:[Json(name = "invited_on") ISO8601] @field:[Json(name = "invited_on") ISO8601]
val invitedOn= LocalDateTime.now() var invitedOn: LocalDateTime = LocalDateTime.now()
/** /**
* ID of the Organization the user will be added to * ID of the Organization the user will be added to
*/ */
@field:[Json(name = "organization_id")] @field:[Json(name = "organization_id")]
val organizationId: String? = null var organizationId: String? = null
/** /**
* When the invite is no longer active * When the invite is no longer active
*/ */
@field:[Json(name = "expires_on")] @field:[Json(name = "expires_on")]
val expiresOn: String? = null var expiresOn: String? = null
/** /**
* Current status of the invitation * Current status of the invitation
* pending, accepted, rejected, expired * pending, accepted, rejected, expired
*/ */
@field:[Json(name = "status")] @field:[Json(name = "status")]
val status = "pending" var status = "pending"
/** /**
* Organization Name * Organization Name
*/ */
@field:[Json(name = "organization_name")] @field:[Json(name = "organization_name")]
val organizationName = "Cloudflare, Inc." var organizationName = "Cloudflare, Inc."
/** /**
* The email address of the user who created the invite * The email address of the user who created the invite
*/ */
@field:[Json(name = "invited_by")] @field:[Json(name = "invited_by")]
val invitedBy: String? = null var invitedBy: String? = null
/** /**
* Email address of the user to be added to the Organization * Email address of the user to be added to the Organization
*/ */
@field:[Json(name = "invited_member_email")] @field:[Json(name = "invited_member_email")]
val invitedMemberEmail: String? = null var invitedMemberEmail: String? = null
/** /**
* Invite identifier tag * Invite identifier tag
*/ */
@field:[Json(name = "id")] @field:[Json(name = "id")]
val id = "" var id = ""
/** /**
* Id of the user to be added to the Organization * Id of the user to be added to the Organization
*/ */
@field:[Json(name = "invited_member_id")] @field:[Json(name = "invited_member_id")]
val invitedMemberId: String? = null var invitedMemberId: String? = null
/** /**
* Roles to be assigned to this Member * Roles to be assigned to this Member
*/ */
@field:[Json(name = "roles")] @field:[Json(name = "roles")]
val roles = listOf<Role>() var roles = listOf<Role>()
override fun toString(): String { override fun toString(): String {
return "Invite(invitedOn=$invitedOn, organizationId=$organizationId, expiresOn=$expiresOn, status='$status', organizationName='$organizationName', invitedBy=$invitedBy, invitedMemberEmail=$invitedMemberEmail, id='$id', invitedMemberId=$invitedMemberId, roles=$roles)" return "Invite(invitedOn=$invitedOn, organizationId=$organizationId, expiresOn=$expiresOn, status='$status', organizationName='$organizationName', invitedBy=$invitedBy, invitedMemberEmail=$invitedMemberEmail, id='$id', invitedMemberId=$invitedMemberId, roles=$roles)"

View File

@ -16,37 +16,39 @@
package dorkbox.kloudflareApi.api.user.invite package dorkbox.kloudflareApi.api.user.invite
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
/** /**
* https://api.cloudflare.com/#user-s-invites-properties * https://api.cloudflare.com/#user-s-invites-properties
*/ */
@JsonClass(generateAdapter = true)
class Role { class Role {
/** /**
* Role identifier tag * Role identifier tag
*/ */
@field:[Json(name = "id")] @field:[Json(name = "id")]
val id = "" var id = ""
/** /**
* Role Name * Role Name
*/ */
@field:[Json(name = "name")] @field:[Json(name = "name")]
val name: String? = null var name: String? = null
/** /**
* Description of role's permissions * Description of role's permissions
*/ */
@field:[Json(name = "description")] @field:[Json(name = "description")]
val description: String? = null var description: String? = null
/** /**
* Access permissions for this User * Access permissions for this User
*/ */
@field:[Json(name = "permissions")] @field:[Json(name = "permissions")]
val permissions = listOf<String>() var permissions = listOf<String>()
override fun toString(): String { override fun toString(): String {
return "Role(id='$id', name=$name, description=$description, permissions=$permissions)" return "Role(id='$id', name=$name, description=$description, permissions=$permissions)"

View File

@ -16,12 +16,14 @@
package dorkbox.kloudflareApi.api.user.subscription package dorkbox.kloudflareApi.api.user.subscription
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
class App { class App {
/** /**
* app install id * app install id
*/ */
@field:[Json(name = "install_id")] @field:[Json(name = "install_id")]
val installId = "" var installId = ""
} }

View File

@ -16,33 +16,35 @@
package dorkbox.kloudflareApi.api.user.subscription package dorkbox.kloudflareApi.api.user.subscription
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
/** /**
* https://api.cloudflare.com/#user-subscription-properties * https://api.cloudflare.com/#user-subscription-properties
*/ */
@JsonClass(generateAdapter = true)
class ComponentValue { class ComponentValue {
/** /**
* The name of the component_value * The name of the component_value
*/ */
@field:[Json(name = "name")] @field:[Json(name = "name")]
val name = "" var name = ""
/** /**
* The amount of the component value assigned * The amount of the component value assigned
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = 0 var value = 0
/** /**
* The default amount assigned. * The default amount assigned.
*/ */
@field:[Json(name = "default")] @field:[Json(name = "default")]
val default = 0 var default = 0
/** /**
* The unit price for the component value * The unit price for the component value
*/ */
@field:[Json(name = "price")] @field:[Json(name = "price")]
val price = 0 var price = 0
} }

View File

@ -16,53 +16,55 @@
package dorkbox.kloudflareApi.api.user.subscription package dorkbox.kloudflareApi.api.user.subscription
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
/** /**
* https://api.cloudflare.com/#user-subscription-properties * https://api.cloudflare.com/#user-subscription-properties
*/ */
@JsonClass(generateAdapter = true)
class RatePlan { class RatePlan {
/** /**
* The ID of the rate_plan * The ID of the rate_plan
*/ */
@field:[Json(name = "id")] @field:[Json(name = "id")]
val id = "" var id = ""
/** /**
* The full name of the rate plan * The full name of the rate plan
*/ */
@field:[Json(name = "public_name")] @field:[Json(name = "public_name")]
val publicName = "" var publicName = ""
/** /**
* The currency applied to the rate_plan subscription * The currency applied to the rate_plan subscription
*/ */
@field:[Json(name = "currency")] @field:[Json(name = "currency")]
val currency = "" var currency = ""
/** /**
* The scope that this rate_plan applies to * The scope that this rate_plan applies to
*/ */
@field:[Json(name = "scope")] @field:[Json(name = "scope")]
val scope = "" var scope = ""
/** /**
* The list of sets this rate_plan applies to * The list of sets this rate_plan applies to
*/ */
@field:[Json(name = "sets")] @field:[Json(name = "sets")]
val sets = listOf<String>() var sets = listOf<String>()
/** /**
* Whether or not a rate_plan is enterprise-based (or newly adopted term contract) * Whether or not a rate_plan is enterprise-based (or newly adopted term contract)
*/ */
@field:[Json(name = "is_contract")] @field:[Json(name = "is_contract")]
val isContract = false var isContract = false
/** /**
* Whether this rate_plan is managed externally from Cloudflare * Whether this rate_plan is managed externally from Cloudflare
*/ */
@field:[Json(name = "externally_managed")] @field:[Json(name = "externally_managed")]
val externallyManaged = false var externallyManaged = false
override fun toString(): String { override fun toString(): String {
return "RatePlan(id='$id', publicName='$publicName', currency='$currency', scope='$scope', sets=$sets, isContract=$isContract, externallyManaged=$externallyManaged)" return "RatePlan(id='$id', publicName='$publicName', currency='$currency', scope='$scope', sets=$sets, isContract=$isContract, externallyManaged=$externallyManaged)"

View File

@ -16,6 +16,7 @@
package dorkbox.kloudflareApi.api.user.subscription package dorkbox.kloudflareApi.api.user.subscription
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import dorkbox.kloudflareApi.api.core.ISO8601 import dorkbox.kloudflareApi.api.core.ISO8601
import dorkbox.kloudflareApi.api.zone.Zone import dorkbox.kloudflareApi.api.zone.Zone
import java.time.LocalDateTime import java.time.LocalDateTime
@ -23,55 +24,56 @@ import java.time.LocalDateTime
/** /**
* https://api.cloudflare.com/#user-subscription-properties * https://api.cloudflare.com/#user-subscription-properties
*/ */
@JsonClass(generateAdapter = true)
class Subscription { class Subscription {
/** /**
* The end of the current period, and also when the next billing is due * The end of the current period, and also when the next billing is due
*/ */
@field:[Json(name = "app")] @field:[Json(name = "app")]
val app = App() var app = App()
/** /**
* The end of the current period, and also when the next billing is due * The end of the current period, and also when the next billing is due
*/ */
@field:[Json(name = "current_period_end") ISO8601] @field:[Json(name = "current_period_end") ISO8601]
val currentPeriodEnd= LocalDateTime.now() var currentPeriodEnd: LocalDateTime = LocalDateTime.now()
/** /**
* The list of add-ons subscribed to * The list of add-ons subscribed to
*/ */
@field:[Json(name = "component_values")] @field:[Json(name = "component_values")]
val componentValues = listOf<ComponentValue>() var componentValues = listOf<ComponentValue>()
/** /**
* The rate plan applied to the subscription * The rate plan applied to the subscription
*/ */
@field:[Json(name = "rate_plan")] @field:[Json(name = "rate_plan")]
val ratePlan = RatePlan() var ratePlan = RatePlan()
/** /**
* The price of the subscription that will be billed, in US dollars * The price of the subscription that will be billed, in US dollars
*/ */
@field:[Json(name = "price")] @field:[Json(name = "price")]
val price = 0 var price = 0
/** /**
* When the current billing period started, may be the same as InitialPeriodStart if this is the first period * When the current billing period started, may be the same as InitialPeriodStart if this is the first period
*/ */
@field:[Json(name = "current_period_start") ISO8601] @field:[Json(name = "current_period_start") ISO8601]
val currentPeriodStart = LocalDateTime.now() var currentPeriodStart: LocalDateTime = LocalDateTime.now()
/** /**
* A simple zone object. May have null properties if not a zone subscription. * A simple zone object. May have null properties if not a zone subscription.
*/ */
@field:[Json(name = "zone")] @field:[Json(name = "zone")]
val zone = Zone() var zone = Zone()
/** /**
* The monetary unit in which pricing information is displayed * The monetary unit in which pricing information is displayed
*/ */
@field:[Json(name = "currency")] @field:[Json(name = "currency")]
val currency = "USD" var currency = "USD"
/** /**
* The state that the subscription is in * The state that the subscription is in
@ -79,13 +81,13 @@ class Subscription {
* Trial, Provisioned, Paid, AwaitingPayment, Cancelled, Failed, Expired * Trial, Provisioned, Paid, AwaitingPayment, Cancelled, Failed, Expired
*/ */
@field:[Json(name = "state")] @field:[Json(name = "state")]
val state = "Expired" var state = "Expired"
/** /**
* Subscription identifier tag * Subscription identifier tag
*/ */
@field:[Json(name = "id")] @field:[Json(name = "id")]
val id = "" var id = ""
/** /**
* How often the subscription is renewed automatically * How often the subscription is renewed automatically
@ -93,7 +95,7 @@ class Subscription {
* weekly, monthly, quarterly, yearly * weekly, monthly, quarterly, yearly
*/ */
@field:[Json(name = "frequency")] @field:[Json(name = "frequency")]
val frequency = "weekly" var frequency = "weekly"
override fun toString(): String { override fun toString(): String {
return "Subscription(app=$app, currentPeriodEnd=$currentPeriodEnd, componentValues=$componentValues, ratePlan=$ratePlan, price=$price, currentPeriodStart=$currentPeriodStart, zone=$zone, currency='$currency', state='$state', id='$id', frequency='$frequency')" return "Subscription(app=$app, currentPeriodEnd=$currentPeriodEnd, componentValues=$componentValues, ratePlan=$ratePlan, price=$price, currentPeriodStart=$currentPeriodStart, zone=$zone, currency='$currency', state='$state', id='$id', frequency='$frequency')"

View File

@ -16,23 +16,25 @@
package dorkbox.kloudflareApi.api.zone package dorkbox.kloudflareApi.api.zone
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
/** /**
* https://api.cloudflare.com/#zone-properties * https://api.cloudflare.com/#zone-properties
*/ */
@JsonClass(generateAdapter = true)
class Account { class Account {
/** /**
* Account identifier tag * Account identifier tag
*/ */
@field:[Json(name = "id")] @field:[Json(name = "id")]
val id = "" var id = ""
/** /**
* Account name * Account name
*/ */
@field:[Json(name = "name")] @field:[Json(name = "name")]
val name = "" var name = ""
override fun toString(): String { override fun toString(): String {
return "Account(id='$id', name='$name')" return "Account(id='$id', name='$name')"

View File

@ -16,10 +16,12 @@
package dorkbox.kloudflareApi.api.zone package dorkbox.kloudflareApi.api.zone
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
/** /**
* https://api.cloudflare.com/#zone-properties * https://api.cloudflare.com/#zone-properties
*/ */
@JsonClass(generateAdapter = true)
class Component { class Component {
/** /**
@ -27,19 +29,19 @@ class Component {
* zones, page_rules, dedicated_certificates, dedicated_certificates_custom * zones, page_rules, dedicated_certificates, dedicated_certificates_custom
*/ */
@field:[Json(name = "name")] @field:[Json(name = "name")]
val name: String? = null var name: String? = null
/** /**
* The default amount allocated * The default amount allocated
*/ */
@field:[Json(name = "default")] @field:[Json(name = "default")]
val default = 5 var default = 5
/** /**
* The unit price of the addon * The unit price of the addon
*/ */
@field:[Json(name = "unit_price")] @field:[Json(name = "unit_price")]
val unitPrice = 0 var unitPrice = 0
override fun toString(): String { override fun toString(): String {
return "Components(name=$name, default=$default, unitPrice=$unitPrice)" return "Components(name=$name, default=$default, unitPrice=$unitPrice)"

View File

@ -16,23 +16,25 @@
package dorkbox.kloudflareApi.api.zone package dorkbox.kloudflareApi.api.zone
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
/** /**
* https://api.cloudflare.com/#zone-properties * https://api.cloudflare.com/#zone-properties
*/ */
@JsonClass(generateAdapter = true)
class Owner { class Owner {
@field:[Json(name = "id")] @field:[Json(name = "id")]
val id = "" var id = ""
/** /**
* The type of owner of the zone * The type of owner of the zone
*/ */
@field:[Json(name = "email")] @field:[Json(name = "email")]
val email = "" var email = ""
@field:[Json(name = "owner_type")] @field:[Json(name = "owner_type")]
val ownerType = "user" var ownerType = "user"
override fun toString(): String { override fun toString(): String {
return "Owner(id='$id', email='$email', ownerType='$ownerType')" return "Owner(id='$id', email='$email', ownerType='$ownerType')"

View File

@ -16,61 +16,63 @@
package dorkbox.kloudflareApi.api.zone package dorkbox.kloudflareApi.api.zone
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
/** /**
* https://api.cloudflare.com/#zone-properties * https://api.cloudflare.com/#zone-properties
*/ */
@JsonClass(generateAdapter = true)
class Plan { class Plan {
/** /**
* Plan identifier tag * Plan identifier tag
*/ */
@field:[Json(name = "id")] @field:[Json(name = "id")]
val id = "" var id = ""
/** /**
* The plan name * The plan name
*/ */
@field:[Json(name = "name")] @field:[Json(name = "name")]
val name: String? = null var name: String? = null
/** /**
* The price of the subscription that will be billed, in US dollars * The price of the subscription that will be billed, in US dollars
*/ */
@field:[Json(name = "price")] @field:[Json(name = "price")]
val price = 0 var price = 0
/** /**
* The monetary unit in which pricing information is displayed * The monetary unit in which pricing information is displayed
*/ */
@field:[Json(name = "currency")] @field:[Json(name = "currency")]
val currency = "USD" var currency = "USD"
/** /**
* The frequency at which you will be billed for this plan * The frequency at which you will be billed for this plan
* weekly, monthly, quarterly, yearly * weekly, monthly, quarterly, yearly
*/ */
@field:[Json(name = "frequency")] @field:[Json(name = "frequency")]
val frequency = "weekly" var frequency = "weekly"
/** /**
* A 'friendly' identifier to indicate to the UI what plan the object is * A 'friendly' identifier to indicate to the UI what plan the object is
* free, pro, business, enterprise * free, pro, business, enterprise
*/ */
@field:[Json(name = "legacy_id")] @field:[Json(name = "legacy_id")]
val legacyId = "free" var legacyId = "free"
/** /**
* If the zone is subscribed to this plan * If the zone is subscribed to this plan
*/ */
@field:[Json(name = "is_subscribed")] @field:[Json(name = "is_subscribed")]
val isSubscribed = false var isSubscribed = false
/** /**
* If the zone is allowed to subscribe to this plan * If the zone is allowed to subscribe to this plan
*/ */
@field:[Json(name = "can_subscribe")] @field:[Json(name = "can_subscribe")]
val canSubscribe = false var canSubscribe = false
override fun toString(): String { override fun toString(): String {
return "Plan(id='$id', name=$name, price=$price, currency='$currency', frequency='$frequency', legacyId='$legacyId', isSubscribed=$isSubscribed, canSubscribe=$canSubscribe)" return "Plan(id='$id', name=$name, price=$price, currency='$currency', frequency='$frequency', legacyId='$legacyId', isSubscribed=$isSubscribed, canSubscribe=$canSubscribe)"

View File

@ -16,61 +16,63 @@
package dorkbox.kloudflareApi.api.zone package dorkbox.kloudflareApi.api.zone
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
/** /**
* https://api.cloudflare.com/#zone-properties * https://api.cloudflare.com/#zone-properties
*/ */
@JsonClass(generateAdapter = true)
class PlanPending { class PlanPending {
/** /**
* Plan identifier tag * Plan identifier tag
*/ */
@field:[Json(name = "id")] @field:[Json(name = "id")]
val id = "" var id = ""
/** /**
* The plan name * The plan name
*/ */
@field:[Json(name = "name")] @field:[Json(name = "name")]
val name = "" var name = ""
/** /**
* The price of the subscription that will be billed, in US dollars * The price of the subscription that will be billed, in US dollars
*/ */
@field:[Json(name = "price")] @field:[Json(name = "price")]
val price = 0 var price = 0
/** /**
* The monetary unit in which pricing information is displayed * The monetary unit in which pricing information is displayed
*/ */
@field:[Json(name = "currency")] @field:[Json(name = "currency")]
val currency = "USD" var currency = "USD"
/** /**
* The frequency at which you will be billed for this plan * The frequency at which you will be billed for this plan
* weekly, monthly, quarterly, yearly * weekly, monthly, quarterly, yearly
*/ */
@field:[Json(name = "frequency")] @field:[Json(name = "frequency")]
val frequency = "weekly" var frequency = "weekly"
/** /**
* A 'friendly' identifier to indicate to the UI what plan the object is * A 'friendly' identifier to indicate to the UI what plan the object is
* free, pro, business, enterprise * free, pro, business, enterprise
*/ */
@field:[Json(name = "legacy_id")] @field:[Json(name = "legacy_id")]
val legacyId = "free" var legacyId = "free"
/** /**
* If the zone is subscribed to this plan * If the zone is subscribed to this plan
*/ */
@field:[Json(name = "is_subscribed")] @field:[Json(name = "is_subscribed")]
val isSubscribed = false var isSubscribed = false
/** /**
* If the zone is allowed to subscribe to this plan * If the zone is allowed to subscribe to this plan
*/ */
@field:[Json(name = "can_subscribe")] @field:[Json(name = "can_subscribe")]
val canSubscribe = false var canSubscribe = false
override fun toString(): String { override fun toString(): String {
return "PlanPending(id='$id', name='$name', price=$price, currency='$currency', frequency='$frequency', legacyId='$legacyId', isSubscribed=$isSubscribed, canSubscribe=$canSubscribe)" return "PlanPending(id='$id', name='$name', price=$price, currency='$currency', frequency='$frequency', legacyId='$legacyId', isSubscribed=$isSubscribed, canSubscribe=$canSubscribe)"

View File

@ -16,48 +16,50 @@
package dorkbox.kloudflareApi.api.zone package dorkbox.kloudflareApi.api.zone
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
/** /**
* https://api.cloudflare.com/#zone-rate-plan-properties * https://api.cloudflare.com/#zone-rate-plan-properties
*/ */
class RatePlan { @JsonClass(generateAdapter = true)
class RatePlan {
/** /**
* Plan identifier tag * Plan identifier tag
*/ */
@field:[Json(name = "id")] @field:[Json(name = "id")]
val id = "free" var id = "free"
/** /**
* The plan name * The plan name
*/ */
@field:[Json(name = "name")] @field:[Json(name = "name")]
val name = "Free Plan" var name = "Free Plan"
/** /**
* The monetary unit in which pricing information is displayed * The monetary unit in which pricing information is displayed
*/ */
@field:[Json(name = "currency")] @field:[Json(name = "currency")]
val currency = "USD" var currency = "USD"
/** /**
* The duration of the plan subscription * The duration of the plan subscription
*/ */
@field:[Json(name = "duration")] @field:[Json(name = "duration")]
val duration = 1 var duration = 1
/** /**
* The frequency at which you will be billed for this plan * The frequency at which you will be billed for this plan
* weekly, monthly, quarterly, yearly * weekly, monthly, quarterly, yearly
*/ */
@field:[Json(name = "frequency")] @field:[Json(name = "frequency")]
val frequency = "monthly" var frequency = "monthly"
/** /**
* Array of available components values for the plan * Array of available components values for the plan
*/ */
@field:[Json(name = "components")] @field:[Json(name = "components")]
val components = listOf<Component>() var components = listOf<Component>()
override fun toString(): String { override fun toString(): String {
return "RatePlan(id='$id', name='$name', currency='$currency', duration=$duration, frequency='$frequency', components=$components)" return "RatePlan(id='$id', name='$name', currency='$currency', duration=$duration, frequency='$frequency', components=$components)"

View File

@ -16,6 +16,7 @@
package dorkbox.kloudflareApi.api.zone package dorkbox.kloudflareApi.api.zone
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import dorkbox.kloudflareApi.Kloudflare import dorkbox.kloudflareApi.Kloudflare
import dorkbox.kloudflareApi.api.core.ISO8601 import dorkbox.kloudflareApi.api.core.ISO8601
import dorkbox.kloudflareApi.api.dns.DnsRecord import dorkbox.kloudflareApi.api.dns.DnsRecord
@ -24,6 +25,7 @@ import java.time.LocalDateTime
/** /**
* https://api.cloudflare.com/#zone-properties * https://api.cloudflare.com/#zone-properties
*/ */
@JsonClass(generateAdapter = true)
class Zone { class Zone {
/** /**
@ -43,111 +45,111 @@ class Zone {
@field:[Json(name = "id")] @field:[Json(name = "id")]
val id: String = "" var id: String = ""
/** /**
* The domain name * The domain name
*/ */
@field:[Json(name = "name")] @field:[Json(name = "name")]
val name = "example.com" var name = "example.com"
/** /**
* The interval (in seconds) from when development mode expires (positive integer) or last expired (negative integer) for the domain. If development mode has never been enabled, this value is 0. * The interval (in seconds) from when development mode expires (positive integer) or last expired (negative integer) for the domain. If development mode has never been enabled, this value is 0.
*/ */
@field:[Json(name = "development_mode")] @field:[Json(name = "development_mode")]
val developmentMode = 0 var developmentMode = 0
/** /**
* Original name servers before moving to Cloudflare * Original name servers before moving to Cloudflare
*/ */
@field:[Json(name = "original_name_servers")] @field:[Json(name = "original_name_servers")]
val originalNameServers: List<String>? = null var originalNameServers: List<String>? = null
/** /**
* Registrar for the domain at the time of switching to Cloudflare * Registrar for the domain at the time of switching to Cloudflare
*/ */
@field:[Json(name = "original_registrar")] @field:[Json(name = "original_registrar")]
val originalRegistrar: String? = null var originalRegistrar: String? = null
/** /**
* DNS host at the time of switching to Cloudflare * DNS host at the time of switching to Cloudflare
*/ */
@field:[Json(name = "original_dnshost")] @field:[Json(name = "original_dnshost")]
val originalDnshost: String? = null var originalDnshost: String? = null
/** /**
* When the zone was created * When the zone was created
*/ */
@field:[Json(name = "created_on") ISO8601] @field:[Json(name = "created_on") ISO8601]
val createdOn = LocalDateTime.now() var createdOn: LocalDateTime = LocalDateTime.now()
/** /**
* When the zone was last modified * When the zone was last modified
*/ */
@field:[Json(name = "modified_on") ISO8601] @field:[Json(name = "modified_on") ISO8601]
val modifiedOn = LocalDateTime.now() var modifiedOn: LocalDateTime = LocalDateTime.now()
/** /**
* Cloudflare-assigned name servers. This is only populated for zones that use Cloudflare DNS * Cloudflare-assigned name servers. This is only populated for zones that use Cloudflare DNS
*/ */
@field:[Json(name = "name_servers")] @field:[Json(name = "name_servers")]
val nameServers = listOf<String>() var nameServers = listOf<String>()
/** /**
* Information about the owner of the zone * Information about the owner of the zone
*/ */
@field:[Json(name = "owner")] @field:[Json(name = "owner")]
val owner = Owner() var owner = Owner()
/** /**
* Information about the account the zone belongs to * Information about the account the zone belongs to
*/ */
@field:[Json(name = "account")] @field:[Json(name = "account")]
val account = Account() var account = Account()
/** /**
* Available permissions on the zone for the current user requesting the item * Available permissions on the zone for the current user requesting the item
*/ */
@field:[Json(name = "permissions")] @field:[Json(name = "permissions")]
val permissions = listOf<String>() var permissions = listOf<String>()
/** /**
* A zone plan * A zone plan
*/ */
@field:[Json(name = "plan")] @field:[Json(name = "plan")]
val plan = Plan() var plan = Plan()
/** /**
* A zone plan * A zone plan
*/ */
@field:[Json(name = "plan_pending")] @field:[Json(name = "plan_pending")]
val planPending = PlanPending() var planPending = PlanPending()
/** /**
* Status of the zone * Status of the zone
* active, pending, initializing, moved, deleted, deactivated * active, pending, initializing, moved, deleted, deactivated
*/ */
@field:[Json(name = "status")] @field:[Json(name = "status")]
val status = "active" var status = "active"
/** /**
* The last time proof of ownership was detected and the zone was made active * The last time proof of ownership was detected and the zone was made active
*/ */
@field:[Json(name = "activated_on") ISO8601] @field:[Json(name = "activated_on") ISO8601]
val activatedOn: LocalDateTime? = null var activatedOn: LocalDateTime? = null
/** /**
* Indicates if the zone is only using Cloudflare DNS services. A true value means the zone will not receive security or performance benefits. * Indicates if the zone is only using Cloudflare DNS services. A true value means the zone will not receive security or performance benefits.
*/ */
@field:[Json(name = "paused")] @field:[Json(name = "paused")]
val paused = false var paused = false
/** /**
* A full zone implies that DNS is hosted with Cloudflare. A partial zone is typically a partner-hosted zone or a CNAME setup. * A full zone implies that DNS is hosted with Cloudflare. A partial zone is typically a partner-hosted zone or a CNAME setup.
* full, partial * full, partial
*/ */
@field:[Json(name = "type")] @field:[Json(name = "type")]
val type = "full" var type = "full"
override fun toString(): String { override fun toString(): String {
return "Zone(id=$id, name='$name', developmentMode=$developmentMode, originalNameServers=$originalNameServers, originalRegistrar=$originalRegistrar, originalDnshost=$originalDnshost, createdOn=$createdOn, modifiedOn=$modifiedOn, nameServers=$nameServers, owner=$owner, account=$account, permissions=$permissions, plan=$plan, planPending=$planPending, status='$status', activatedOn=$activatedOn, paused=$paused, type='$type')" return "Zone(id=$id, name='$name', developmentMode=$developmentMode, originalNameServers=$originalNameServers, originalRegistrar=$originalRegistrar, originalDnshost=$originalDnshost, createdOn=$createdOn, modifiedOn=$modifiedOn, nameServers=$nameServers, owner=$owner, account=$account, permissions=$permissions, plan=$plan, planPending=$planPending, status='$status', activatedOn=$activatedOn, paused=$paused, type='$type')"

View File

@ -16,28 +16,30 @@
package dorkbox.kloudflareApi.api.zone.settings package dorkbox.kloudflareApi.api.zone.settings
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
class MinifyAssetsSetting { class MinifyAssetsSetting {
/** /**
* Account identifier tag * Account identifier tag
* on, off * on, off
*/ */
@field:[Json(name = "css")] @field:[Json(name = "css")]
val css = "" var css = ""
/** /**
* Account identifier tag * Account identifier tag
* on, off * on, off
*/ */
@field:[Json(name = "html")] @field:[Json(name = "html")]
val html = "" var html = ""
/** /**
* Account identifier tag * Account identifier tag
* on, off * on, off
*/ */
@field:[Json(name = "js")] @field:[Json(name = "js")]
val js = "" var js = ""
override fun toString(): String { override fun toString(): String {
return "MinifyAssets(css='$css', html='$html', js='$js')" return "MinifyAssets(css='$css', html='$html', js='$js')"

View File

@ -16,31 +16,31 @@
package dorkbox.kloudflareApi.api.zone.settings package dorkbox.kloudflareApi.api.zone.settings
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
class MobileRedirectSetting { class MobileRedirectSetting {
/** /**
* Whether or not the mobile redirection is enabled * Whether or not the mobile redirection is enabled
* on, off * on, off
*/ */
@field:[Json(name = "status")] @field:[Json(name = "status")]
val status = "" var status = ""
/** /**
* Which subdomain prefix you wish to redirect visitors on mobile devices to (subdomain must already exist). * Which subdomain prefix you wish to redirect visitors on mobile devices to (subdomain must already exist).
*/ */
@field:[Json(name = "mobile_subdomain")] @field:[Json(name = "mobile_subdomain")]
val mobileSubdomain: String? = null var mobileSubdomain: String? = null
/** /**
* Whether to drop the current page path and redirect to the mobile subdomain URL root or to keep the path and redirect to the same page on the mobile subdomain * Whether to drop the current page path and redirect to the mobile subdomain URL root or to keep the path and redirect to the same page on the mobile subdomain
* on, off * on, off
*/ */
@field:[Json(name = "strip_uri")] @field:[Json(name = "strip_uri")]
val strip_uri = false var strip_uri = false
override fun toString(): String { override fun toString(): String {
return "MobileRedirectSetting(status='$status', mobileSubdomain=$mobileSubdomain, strip_uri=$strip_uri)" return "MobileRedirectSetting(status='$status', mobileSubdomain=$mobileSubdomain, strip_uri=$strip_uri)"
} }
} }

View File

@ -16,7 +16,9 @@
package dorkbox.kloudflareApi.api.zone.settings package dorkbox.kloudflareApi.api.zone.settings
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
class SecurityHeadingSetting { class SecurityHeadingSetting {
/** /**
* Whether or not strict transport security is enabled * Whether or not strict transport security is enabled

View File

@ -16,19 +16,21 @@
package dorkbox.kloudflareApi.api.zone.settings package dorkbox.kloudflareApi.api.zone.settings
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import dorkbox.kloudflareApi.api.core.ISO8601 import dorkbox.kloudflareApi.api.core.ISO8601
import java.time.LocalDateTime import java.time.LocalDateTime
/** /**
* Always Online Mode * Always Online Mode
*/ */
@JsonClass(generateAdapter = true)
class AlwaysOnline : ZoneSetting() { class AlwaysOnline : ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "AlwaysOnline(value='$value')" + super.toString() return "AlwaysOnline(value='$value')" + super.toString()
@ -38,6 +40,7 @@ class AlwaysOnline : ZoneSetting() {
/** /**
* Advanced DDoS Protection * Advanced DDoS Protection
*/ */
@JsonClass(generateAdapter = true)
class AdvancedDDos : ZoneSetting() { class AdvancedDDos : ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
@ -45,7 +48,7 @@ class AdvancedDDos : ZoneSetting() {
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "off" var value = "off"
override fun toString(): String { override fun toString(): String {
return "AdvancedDDos(value='$value')" + super.toString() return "AdvancedDDos(value='$value')" + super.toString()
@ -55,13 +58,14 @@ class AdvancedDDos : ZoneSetting() {
/** /**
* Brotli Compression * Brotli Compression
*/ */
@JsonClass(generateAdapter = true)
class Brotli : ZoneSetting() { class Brotli : ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "Brotli(value='$value')" + super.toString() return "Brotli(value='$value')" + super.toString()
@ -71,6 +75,7 @@ class Brotli : ZoneSetting() {
/** /**
* Browser Cache TTL * Browser Cache TTL
*/ */
@JsonClass(generateAdapter = true)
class BrowserCacheTtl : ZoneSetting() { class BrowserCacheTtl : ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
@ -81,7 +86,7 @@ class BrowserCacheTtl : ZoneSetting() {
* notes: The minimum TTL available depends on the plan level of the zone. (Enterprise = 30, Business = 1800, Pro = 1800, Free = 1800) * notes: The minimum TTL available depends on the plan level of the zone. (Enterprise = 30, Business = 1800, Pro = 1800, Free = 1800)
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = 14400 var value = 14400
override fun toString(): String { override fun toString(): String {
return "BrowserCacheTtl(value=$value)" + super.toString() return "BrowserCacheTtl(value=$value)" + super.toString()
@ -91,13 +96,14 @@ class BrowserCacheTtl : ZoneSetting() {
/** /**
* Browser Check * Browser Check
*/ */
@JsonClass(generateAdapter = true)
class BrowserCheck : ZoneSetting() { class BrowserCheck : ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "BrowserCheck(value='$value')" + super.toString() return "BrowserCheck(value='$value')" + super.toString()
@ -108,13 +114,14 @@ class BrowserCheck : ZoneSetting() {
/** /**
* Cloudflare CNAME Flattening * Cloudflare CNAME Flattening
*/ */
@JsonClass(generateAdapter = true)
class FlattenAtRoot: ZoneSetting() { class FlattenAtRoot: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* flatten_at_root, flatten_all * flatten_at_root, flatten_all
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "flatten_at_root" var value = "flatten_at_root"
override fun toString(): String { override fun toString(): String {
return "FlattenAtRoot(value='$value')" + super.toString() return "FlattenAtRoot(value='$value')" + super.toString()
@ -125,13 +132,14 @@ class FlattenAtRoot: ZoneSetting() {
/** /**
* Cloudflare Cache Level * Cloudflare Cache Level
*/ */
@JsonClass(generateAdapter = true)
class CacheLevel: ZoneSetting() { class CacheLevel: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* aggressive, basic, simplified * aggressive, basic, simplified
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "aggressive" var value = "aggressive"
override fun toString(): String { override fun toString(): String {
return "CacheLevel(value='$value')" + super.toString() return "CacheLevel(value='$value')" + super.toString()
@ -141,6 +149,7 @@ class CacheLevel: ZoneSetting() {
/** /**
* Challenge Page TTL * Challenge Page TTL
*/ */
@JsonClass(generateAdapter = true)
class ChallengePageTtl: ZoneSetting() { class ChallengePageTtl: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
@ -148,7 +157,7 @@ class ChallengePageTtl: ZoneSetting() {
* valid values: 300, 900, 1800, 2700, 3600, 7200, 10800, 14400, 28800, 57600, 86400, 604800, 2592000, 31536000 * valid values: 300, 900, 1800, 2700, 3600, 7200, 10800, 14400, 28800, 57600, 86400, 604800, 2592000, 31536000
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = 1800 var value = 1800
override fun toString(): String { override fun toString(): String {
return "ChallengePageTtl(value=$value)" + super.toString() return "ChallengePageTtl(value=$value)" + super.toString()
@ -158,13 +167,14 @@ class ChallengePageTtl: ZoneSetting() {
/** /**
* Development Mode * Development Mode
*/ */
@JsonClass(generateAdapter = true)
class DevelopmentMode: ZoneSetting() { class DevelopmentMode: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
/** /**
* Value of the zone setting * Value of the zone setting
@ -173,7 +183,7 @@ class DevelopmentMode: ZoneSetting() {
* for the domain. If development mode has never been enabled, this value is false. * for the domain. If development mode has never been enabled, this value is false.
*/ */
@field:[Json(name = "time_remaining")] @field:[Json(name = "time_remaining")]
val timeRemaining = 0 var timeRemaining = 0
override fun toString(): String { override fun toString(): String {
return "DevelopmentMode(value='$value', timeRemaining=$timeRemaining)" + super.toString() return "DevelopmentMode(value='$value', timeRemaining=$timeRemaining)" + super.toString()
@ -183,6 +193,7 @@ class DevelopmentMode: ZoneSetting() {
/** /**
* Edge Cache TTL * Edge Cache TTL
*/ */
@JsonClass(generateAdapter = true)
class EdgeCacheTtl: ZoneSetting() { class EdgeCacheTtl: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
@ -192,7 +203,7 @@ class EdgeCacheTtl: ZoneSetting() {
* notes: The minimum TTL available depends on the plan level of the zone. (Enterprise = 30, Business = 1800, Pro = 3600, Free = 7200) * notes: The minimum TTL available depends on the plan level of the zone. (Enterprise = 30, Business = 1800, Pro = 3600, Free = 7200)
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = 1800 var value = 1800
override fun toString(): String { override fun toString(): String {
return "EdgeCacheTtl(value=$value)" + super.toString() return "EdgeCacheTtl(value=$value)" + super.toString()
@ -202,13 +213,14 @@ class EdgeCacheTtl: ZoneSetting() {
/** /**
* Error Pages On * Error Pages On
*/ */
@JsonClass(generateAdapter = true)
class ErrorPagesOn: ZoneSetting() { class ErrorPagesOn: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "ErrorPagesOn(value='$value')" + super.toString() return "ErrorPagesOn(value='$value')" + super.toString()
@ -219,13 +231,14 @@ class ErrorPagesOn: ZoneSetting() {
/** /**
* Get String Sort * Get String Sort
*/ */
@JsonClass(generateAdapter = true)
class StringSort: ZoneSetting() { class StringSort: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "StringSort(value='$value')" + super.toString() return "StringSort(value='$value')" + super.toString()
@ -235,13 +248,14 @@ class StringSort: ZoneSetting() {
/** /**
* Email Obfuscation * Email Obfuscation
*/ */
@JsonClass(generateAdapter = true)
class EmailObfuscation: ZoneSetting() { class EmailObfuscation: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "EmailObfuscation(value='$value')" + super.toString() return "EmailObfuscation(value='$value')" + super.toString()
@ -251,13 +265,14 @@ class EmailObfuscation: ZoneSetting() {
/** /**
* Hotlink Protection * Hotlink Protection
*/ */
@JsonClass(generateAdapter = true)
class HotlinkProtection: ZoneSetting() { class HotlinkProtection: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "HotlinkProtection(value='$value')" + super.toString() return "HotlinkProtection(value='$value')" + super.toString()
@ -267,13 +282,14 @@ class HotlinkProtection: ZoneSetting() {
/** /**
* IP Geolocation * IP Geolocation
*/ */
@JsonClass(generateAdapter = true)
class IpGeolocation: ZoneSetting() { class IpGeolocation: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "IpGeolocation(value='$value')" + super.toString() return "IpGeolocation(value='$value')" + super.toString()
@ -283,13 +299,14 @@ class IpGeolocation: ZoneSetting() {
/** /**
* IPv6 * IPv6
*/ */
@JsonClass(generateAdapter = true)
class IPv6: ZoneSetting() { class IPv6: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "IPv6(value='$value')" + super.toString() return "IPv6(value='$value')" + super.toString()
@ -299,13 +316,14 @@ class IPv6: ZoneSetting() {
/** /**
* WebSockets * WebSockets
*/ */
@JsonClass(generateAdapter = true)
class Websockets: ZoneSetting() { class Websockets: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "Websockets(value='$value')" + super.toString() return "Websockets(value='$value')" + super.toString()
@ -315,13 +333,14 @@ class Websockets: ZoneSetting() {
/** /**
* Toggle SHA1 support * Toggle SHA1 support
*/ */
@JsonClass(generateAdapter = true)
class ToggleSha1: ZoneSetting() { class ToggleSha1: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "ToggleSha1(value='$value')" + super.toString() return "ToggleSha1(value='$value')" + super.toString()
@ -331,13 +350,14 @@ class ToggleSha1: ZoneSetting() {
/** /**
* TLS1.2 Only * TLS1.2 Only
*/ */
@JsonClass(generateAdapter = true)
class Tls1_2Only: ZoneSetting() { class Tls1_2Only: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "Tls1_2Only(value='$value')" + super.toString() return "Tls1_2Only(value='$value')" + super.toString()
@ -347,13 +367,14 @@ class Tls1_2Only: ZoneSetting() {
/** /**
* Auto-Minify Assets * Auto-Minify Assets
*/ */
@JsonClass(generateAdapter = true)
class AutoMinify: ZoneSetting() { class AutoMinify: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = MinifyAssetsSetting() var value = MinifyAssetsSetting()
override fun toString(): String { override fun toString(): String {
return "AutoMinify(value=$value)" + super.toString() return "AutoMinify(value=$value)" + super.toString()
@ -363,6 +384,7 @@ class AutoMinify: ZoneSetting() {
/** /**
* Max Upload * Max Upload
*/ */
@JsonClass(generateAdapter = true)
class MaxUpload: ZoneSetting() { class MaxUpload: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
@ -371,7 +393,7 @@ class MaxUpload: ZoneSetting() {
* notes: The size depends on the plan level of the zone. (Enterprise = 500, Business = 200, Pro = 100, Free = 100) * notes: The size depends on the plan level of the zone. (Enterprise = 500, Business = 200, Pro = 100, Free = 100)
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = 100 var value = 100
override fun toString(): String { override fun toString(): String {
return "MaxUpload(value=$value)" + super.toString() return "MaxUpload(value=$value)" + super.toString()
@ -381,13 +403,14 @@ class MaxUpload: ZoneSetting() {
/** /**
* Mobile Redirect * Mobile Redirect
*/ */
@JsonClass(generateAdapter = true)
class MobileRedirect: ZoneSetting() { class MobileRedirect: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = MobileRedirectSetting() var value = MobileRedirectSetting()
override fun toString(): String { override fun toString(): String {
return "MobileRedirect(value=$value)" + super.toString() return "MobileRedirect(value=$value)" + super.toString()
@ -397,13 +420,14 @@ class MobileRedirect: ZoneSetting() {
/** /**
* Mirage Image Optimization * Mirage Image Optimization
*/ */
@JsonClass(generateAdapter = true)
class Mirage: ZoneSetting() { class Mirage: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "Mirage(value='$value')" + super.toString() return "Mirage(value='$value')" + super.toString()
@ -413,13 +437,14 @@ class Mirage: ZoneSetting() {
/** /**
* Polish Image Optimization * Polish Image Optimization
*/ */
@JsonClass(generateAdapter = true)
class PolishImage: ZoneSetting() { class PolishImage: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* off, lossless, lossy * off, lossless, lossy
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "off" var value = "off"
override fun toString(): String { override fun toString(): String {
return "PolishImage(value='$value')" + super.toString() return "PolishImage(value='$value')" + super.toString()
@ -429,13 +454,14 @@ class PolishImage: ZoneSetting() {
/** /**
* Polish WebP Conversion * Polish WebP Conversion
*/ */
@JsonClass(generateAdapter = true)
class PolishWebP: ZoneSetting() { class PolishWebP: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "PolishWebP(value='$value')" + super.toString() return "PolishWebP(value='$value')" + super.toString()
@ -445,13 +471,14 @@ class PolishWebP: ZoneSetting() {
/** /**
* Prefetch Preload * Prefetch Preload
*/ */
@JsonClass(generateAdapter = true)
class PrefetchPreload: ZoneSetting() { class PrefetchPreload: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "PrefetchPreload(value='$value')" + super.toString() return "PrefetchPreload(value='$value')" + super.toString()
@ -461,13 +488,14 @@ class PrefetchPreload: ZoneSetting() {
/** /**
* Privacy Pass * Privacy Pass
*/ */
@JsonClass(generateAdapter = true)
class PrivatePass: ZoneSetting() { class PrivatePass: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "PrivatePass(value='$value')" + super.toString() return "PrivatePass(value='$value')" + super.toString()
@ -477,13 +505,14 @@ class PrivatePass: ZoneSetting() {
/** /**
* Response Buffering * Response Buffering
*/ */
@JsonClass(generateAdapter = true)
class ReponseBuffering: ZoneSetting() { class ReponseBuffering: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "ReponseBuffering(value='$value')" + super.toString() return "ReponseBuffering(value='$value')" + super.toString()
@ -493,13 +522,14 @@ class ReponseBuffering: ZoneSetting() {
/** /**
* Rocket Loader * Rocket Loader
*/ */
@JsonClass(generateAdapter = true)
class RocketLoader: ZoneSetting() { class RocketLoader: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "RocketLoader(value='$value')" + super.toString() return "RocketLoader(value='$value')" + super.toString()
@ -509,12 +539,13 @@ class RocketLoader: ZoneSetting() {
/** /**
* Security Header * Security Header
*/ */
@JsonClass(generateAdapter = true)
class SecurityHeader: ZoneSetting() { class SecurityHeader: ZoneSetting() {
/** /**
* Current value of the zone setting * Current value of the zone setting
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = SecurityHeadingSetting() var value = SecurityHeadingSetting()
override fun toString(): String { override fun toString(): String {
return "SecurityHeader(value=$value)" + super.toString() return "SecurityHeader(value=$value)" + super.toString()
@ -524,13 +555,14 @@ class SecurityHeader: ZoneSetting() {
/** /**
* Security Level * Security Level
*/ */
@JsonClass(generateAdapter = true)
class SecurityLevel: ZoneSetting() { class SecurityLevel: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = SecurityHeadingSetting() var value = SecurityHeadingSetting()
override fun toString(): String { override fun toString(): String {
return "SecurityLevel(value=$value)" + super.toString() return "SecurityLevel(value=$value)" + super.toString()
@ -540,13 +572,14 @@ class SecurityLevel: ZoneSetting() {
/** /**
* Server Side Exclude * Server Side Exclude
*/ */
@JsonClass(generateAdapter = true)
class ServerSideExclude: ZoneSetting() { class ServerSideExclude: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "ServerSideExclude(value='$value')" + super.toString() return "ServerSideExclude(value='$value')" + super.toString()
@ -556,6 +589,7 @@ class ServerSideExclude: ZoneSetting() {
/** /**
* SSL * SSL
*/ */
@JsonClass(generateAdapter = true)
class SSL: ZoneSetting() { class SSL: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
@ -564,7 +598,7 @@ class SSL: ZoneSetting() {
* notes: Depends on the zone's plan level * notes: Depends on the zone's plan level
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "off" var value = "off"
override fun toString(): String { override fun toString(): String {
return "SSL(value='$value')" + super.toString() return "SSL(value='$value')" + super.toString()
@ -574,6 +608,7 @@ class SSL: ZoneSetting() {
/** /**
* TLS Client Authentication * TLS Client Authentication
*/ */
@JsonClass(generateAdapter = true)
class TlsClientAuth: ZoneSetting() { class TlsClientAuth: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
@ -582,7 +617,7 @@ class TlsClientAuth: ZoneSetting() {
* notes: Depends on the zone's plan level * notes: Depends on the zone's plan level
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "off" var value = "off"
override fun toString(): String { override fun toString(): String {
return "TlsClientAuth(value='$value')" + super.toString() return "TlsClientAuth(value='$value')" + super.toString()
@ -592,6 +627,7 @@ class TlsClientAuth: ZoneSetting() {
/** /**
* True Client IP Header * True Client IP Header
*/ */
@JsonClass(generateAdapter = true)
class TrueClientIPHeader: ZoneSetting() { class TrueClientIPHeader: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
@ -600,7 +636,7 @@ class TrueClientIPHeader: ZoneSetting() {
* notes: Depends on the zone's plan level * notes: Depends on the zone's plan level
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "off" var value = "off"
override fun toString(): String { override fun toString(): String {
return "TrueClientIPHeader(value='$value')" + super.toString() return "TrueClientIPHeader(value='$value')" + super.toString()
@ -610,13 +646,14 @@ class TrueClientIPHeader: ZoneSetting() {
/** /**
* Web Application Firewall * Web Application Firewall
*/ */
@JsonClass(generateAdapter = true)
class WebApplicationFirewall: ZoneSetting() { class WebApplicationFirewall: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "WebApplicationFirewall(value='$value')" + super.toString() return "WebApplicationFirewall(value='$value')" + super.toString()
@ -627,13 +664,14 @@ class WebApplicationFirewall: ZoneSetting() {
/** /**
* Zone Minimum TLS Version Value * Zone Minimum TLS Version Value
*/ */
@JsonClass(generateAdapter = true)
class ZoneMinimumTLSVersionValue: ZoneSetting() { class ZoneMinimumTLSVersionValue: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* 1.0, 1.1, 1.2, 1.3 * 1.0, 1.1, 1.2, 1.3
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = 1.0 var value = 1.0
override fun toString(): String { override fun toString(): String {
return "ZoneMinimumTLSVersionValue(value=$value)" + super.toString() return "ZoneMinimumTLSVersionValue(value=$value)" + super.toString()
@ -644,13 +682,14 @@ class ZoneMinimumTLSVersionValue: ZoneSetting() {
/** /**
* Zone Enable TLS 1.3 * Zone Enable TLS 1.3
*/ */
@JsonClass(generateAdapter = true)
class ZoneEnableTLS1_3: ZoneSetting() { class ZoneEnableTLS1_3: ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off, zrt * on, off, zrt
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "ZoneEnableTLS1_3(value='$value')" + super.toString() return "ZoneEnableTLS1_3(value='$value')" + super.toString()
@ -660,13 +699,14 @@ class ZoneEnableTLS1_3: ZoneSetting() {
/** /**
* Zone Enable Opportunistic Encryption * Zone Enable Opportunistic Encryption
*/ */
@JsonClass(generateAdapter = true)
class ZoneEnableOpportunisticEncryption : ZoneSetting() { class ZoneEnableOpportunisticEncryption : ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off, zrt * on, off, zrt
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "ZoneEnableOpportunisticEncryption(value='$value')" + super.toString() return "ZoneEnableOpportunisticEncryption(value='$value')" + super.toString()
@ -676,13 +716,14 @@ class ZoneEnableOpportunisticEncryption : ZoneSetting() {
/** /**
* Zone Enable Automatic HTTPS Rewrites * Zone Enable Automatic HTTPS Rewrites
*/ */
@JsonClass(generateAdapter = true)
class ZoneEnableAutomaticHTTPSRewrites : ZoneSetting() { class ZoneEnableAutomaticHTTPSRewrites : ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off, zrt * on, off, zrt
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "ZoneEnableAutomaticHTTPSRewrites(value='$value')" + super.toString() return "ZoneEnableAutomaticHTTPSRewrites(value='$value')" + super.toString()
@ -692,13 +733,14 @@ class ZoneEnableAutomaticHTTPSRewrites : ZoneSetting() {
/** /**
* HTTP2 * HTTP2
*/ */
@JsonClass(generateAdapter = true)
class HTTP2 : ZoneSetting() { class HTTP2 : ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off, zrt * on, off, zrt
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "HTTP2(value='$value')" + super.toString() return "HTTP2(value='$value')" + super.toString()
@ -708,13 +750,14 @@ class HTTP2 : ZoneSetting() {
/** /**
* Pseudo IPv4 Value * Pseudo IPv4 Value
*/ */
@JsonClass(generateAdapter = true)
class PseudoIPv4 : ZoneSetting() { class PseudoIPv4 : ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* off, add_header, overwrite_header * off, add_header, overwrite_header
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "PseudoIPv4(value='$value')" + super.toString() return "PseudoIPv4(value='$value')" + super.toString()
@ -724,13 +767,14 @@ class PseudoIPv4 : ZoneSetting() {
/** /**
* Zone Enable Always Use HTTPS * Zone Enable Always Use HTTPS
*/ */
@JsonClass(generateAdapter = true)
class ZoneEnableAlwaysUseHTTPS : ZoneSetting() { class ZoneEnableAlwaysUseHTTPS : ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "ZoneEnableAlwaysUseHTTPS(value='$value')" + super.toString() return "ZoneEnableAlwaysUseHTTPS(value='$value')" + super.toString()
@ -740,13 +784,14 @@ class ZoneEnableAlwaysUseHTTPS : ZoneSetting() {
/** /**
* Zone Enable Onion Routing * Zone Enable Onion Routing
*/ */
@JsonClass(generateAdapter = true)
class ZoneEnableOnionRouting : ZoneSetting() { class ZoneEnableOnionRouting : ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off * on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "ZoneEnableOnionRouting(value='$value')" + super.toString() return "ZoneEnableOnionRouting(value='$value')" + super.toString()
@ -756,13 +801,14 @@ class ZoneEnableOnionRouting : ZoneSetting() {
/** /**
* Image Resizing * Image Resizing
*/ */
@JsonClass(generateAdapter = true)
class ImageResizing : ZoneSetting() { class ImageResizing : ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
*on, off *on, off
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "ImageResizing(value='$value')" + super.toString() return "ImageResizing(value='$value')" + super.toString()
@ -772,13 +818,14 @@ class ImageResizing : ZoneSetting() {
/** /**
* HTTP/2 Edge Prioritization * HTTP/2 Edge Prioritization
*/ */
@JsonClass(generateAdapter = true)
class HTTP2EdgePrioritization : ZoneSetting() { class HTTP2EdgePrioritization : ZoneSetting() {
/** /**
* Value of the zone setting * Value of the zone setting
* on, off, custom * on, off, custom
*/ */
@field:[Json(name = "value")] @field:[Json(name = "value")]
val value = "on" var value = "on"
override fun toString(): String { override fun toString(): String {
return "HTTP2EdgePrioritization(value='$value')" + super.toString() return "HTTP2EdgePrioritization(value='$value')" + super.toString()
@ -790,6 +837,7 @@ class HTTP2EdgePrioritization : ZoneSetting() {
/** /**
* https://api.cloudflare.com/#zone-settings-properties * https://api.cloudflare.com/#zone-settings-properties
*/ */
@JsonClass(generateAdapter = true)
open class ZoneSetting { open class ZoneSetting {
/** /**
@ -803,19 +851,19 @@ open class ZoneSetting {
* automatic_https_rewrites, http2, , pseudo_ipv4, always_use_https, opportunistic_onion, image_resizing, h2_prioritization * automatic_https_rewrites, http2, , pseudo_ipv4, always_use_https, opportunistic_onion, image_resizing, h2_prioritization
*/ */
@field:[Json(name = "id")] @field:[Json(name = "id")]
val id = "" var id = ""
/** /**
* Whether or not this setting can be modified for this zone (based on your Cloudflare plan level) * Whether or not this setting can be modified for this zone (based on your Cloudflare plan level)
*/ */
@field:[Json(name = "editable")] @field:[Json(name = "editable")]
val editable = true var editable = true
/** /**
* last time this setting was modified * last time this setting was modified
*/ */
@field:[Json(name = "modified_on") ISO8601] @field:[Json(name = "modified_on") ISO8601]
val modifiedOn: LocalDateTime? = null var modifiedOn: LocalDateTime? = null
override fun toString(): String { override fun toString(): String {
return "ZoneSetting(id='$id', editable=$editable, modifiedOn=$modifiedOn)" return "ZoneSetting(id='$id', editable=$editable, modifiedOn=$modifiedOn)"