diff --git a/src/dorkbox/kloudflareApi/api/core/CfErrorResponse.kt b/src/dorkbox/kloudflareApi/api/core/CfErrorResponse.kt index 3c17588..2334424 100644 --- a/src/dorkbox/kloudflareApi/api/core/CfErrorResponse.kt +++ b/src/dorkbox/kloudflareApi/api/core/CfErrorResponse.kt @@ -16,10 +16,12 @@ package dorkbox.kloudflareApi.api.core import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** * Date fields will always be in UTC ISO-8601 format, including microseconds. */ +@JsonClass(generateAdapter = true) open class CfErrorResponse { // HTTP response codes //200 OK request successful @@ -32,16 +34,16 @@ open class CfErrorResponse { //415 Unsupported Media Type response is not valid JSON @field:[Json(name = "success")] - val success = false + var success = false @field:[Json(name = "errors")] - val errors = listOf() + var errors = listOf() @field:[Json(name = "messages")] - val messages = listOf() + var messages = listOf() @field:[Json(name = "result_info")] - val resultInfo: ResultInfo? = null + var resultInfo: ResultInfo? = null override fun toString(): String { return "Response(success=$success, errors=$errors, messages=$messages, resultInfo=$resultInfo)" diff --git a/src/dorkbox/kloudflareApi/api/core/CfResponse.kt b/src/dorkbox/kloudflareApi/api/core/CfResponse.kt index 0850944..f130363 100644 --- a/src/dorkbox/kloudflareApi/api/core/CfResponse.kt +++ b/src/dorkbox/kloudflareApi/api/core/CfResponse.kt @@ -16,10 +16,12 @@ package dorkbox.kloudflareApi.api.core import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** * Date fields will always be in UTC ISO-8601 format, including microseconds. */ +@JsonClass(generateAdapter = true) open class CfResponse { // HTTP response codes //200 OK request successful @@ -35,19 +37,19 @@ open class CfResponse { * 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")] - val result: T? = null + var result: T? = null @field:[Json(name = "success")] - val success = false + var success = false @field:[Json(name = "errors")] - val errors = listOf() + var errors = listOf() @field:[Json(name = "messages")] - val messages = listOf() + var messages = listOf() @field:[Json(name = "result_info")] - val resultInfo: ResultInfo? = null + var resultInfo: ResultInfo? = null override fun toString(): String { return "Response(result=$result, success=$success, errors=$errors, messages=$messages, resultInfo=$resultInfo)" diff --git a/src/dorkbox/kloudflareApi/api/core/Error.kt b/src/dorkbox/kloudflareApi/api/core/Error.kt index 899b598..0d98df8 100644 --- a/src/dorkbox/kloudflareApi/api/core/Error.kt +++ b/src/dorkbox/kloudflareApi/api/core/Error.kt @@ -16,11 +16,13 @@ package dorkbox.kloudflareApi.api.core import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) class Error { @field:[Json(name = "code")] - val code = 0 + var code = 0 @field:[Json(name = "message")] - val message = "" + var message = "" } diff --git a/src/dorkbox/kloudflareApi/api/core/ResultInfo.kt b/src/dorkbox/kloudflareApi/api/core/ResultInfo.kt index a01615b..0c46d4b 100644 --- a/src/dorkbox/kloudflareApi/api/core/ResultInfo.kt +++ b/src/dorkbox/kloudflareApi/api/core/ResultInfo.kt @@ -16,19 +16,21 @@ package dorkbox.kloudflareApi.api.core import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) class ResultInfo { @field:[Json(name = "page")] - val page = 1 + var page = 1 @field:[Json(name = "per_page")] - val perPage = 20 + var perPage = 20 @field:[Json(name = "count")] - val count = 1 + var count = 1 @field:[Json(name = "total_count")] - val totalCount = 200 + var totalCount = 200 override fun toString(): String { return "ResultInfo(page=$page, perPage=$perPage, count=$count, totalCount=$totalCount)" diff --git a/src/dorkbox/kloudflareApi/api/dns/CreateDnsRecord.kt b/src/dorkbox/kloudflareApi/api/dns/CreateDnsRecord.kt index 5b11428..cef6fe0 100644 --- a/src/dorkbox/kloudflareApi/api/dns/CreateDnsRecord.kt +++ b/src/dorkbox/kloudflareApi/api/dns/CreateDnsRecord.kt @@ -16,23 +16,19 @@ package dorkbox.kloudflareApi.api.dns 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-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) { - - /** - * NOTE: This is not part of the Cloudflare API - * - * Used to associate this dns record with it's zone - */ - @Transient - val zone = zone - - - +@JsonClass(generateAdapter = true) +open class CreateDnsRecord(@Transient val zone: Zone = Zone()) { /** * Record type diff --git a/src/dorkbox/kloudflareApi/api/dns/DeleteDnsRecord.kt b/src/dorkbox/kloudflareApi/api/dns/DeleteDnsRecord.kt index ad27df5..6c3bacf 100644 --- a/src/dorkbox/kloudflareApi/api/dns/DeleteDnsRecord.kt +++ b/src/dorkbox/kloudflareApi/api/dns/DeleteDnsRecord.kt @@ -16,10 +16,12 @@ package dorkbox.kloudflareApi.api.dns import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** * https://api.cloudflare.com/#dns-records-for-a-zone-delete-dns-record */ +@JsonClass(generateAdapter = true) open class DeleteDnsRecord { /** * DNS record identifier tag diff --git a/src/dorkbox/kloudflareApi/api/dns/DnsRecord.kt b/src/dorkbox/kloudflareApi/api/dns/DnsRecord.kt index edc1f15..0add1ac 100644 --- a/src/dorkbox/kloudflareApi/api/dns/DnsRecord.kt +++ b/src/dorkbox/kloudflareApi/api/dns/DnsRecord.kt @@ -16,6 +16,7 @@ package dorkbox.kloudflareApi.api.dns import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import dorkbox.kloudflareApi.api.core.ISO8601 import dorkbox.kloudflareApi.api.zone.Zone import java.time.LocalDateTime @@ -23,6 +24,7 @@ import java.time.LocalDateTime /** * https://api.cloudflare.com/#dns-records-for-a-zone-properties */ +@JsonClass(generateAdapter = true) open class DnsRecord { /** * NOTE: This is not part of the Cloudflare API @@ -105,13 +107,13 @@ open class DnsRecord { * When the record was last modified */ @field:[Json(name = "modified_on") ISO8601] - var modifiedOn = LocalDateTime.now() + var modifiedOn: LocalDateTime = LocalDateTime.now() /** * When the record was created */ @field:[Json(name = "created_on") ISO8601] - var createdOn = LocalDateTime.now() + var createdOn: LocalDateTime = LocalDateTime.now() /** * Extra Cloudflare-specific information about the record diff --git a/src/dorkbox/kloudflareApi/api/dns/Meta.kt b/src/dorkbox/kloudflareApi/api/dns/Meta.kt index f45a24d..a9f3a56 100644 --- a/src/dorkbox/kloudflareApi/api/dns/Meta.kt +++ b/src/dorkbox/kloudflareApi/api/dns/Meta.kt @@ -16,19 +16,21 @@ package dorkbox.kloudflareApi.api.dns import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** * https://api.cloudflare.com/#dns-records-for-a-zone-properties */ +@JsonClass(generateAdapter = true) class Meta { /** * Will exist if Cloudflare automatically added this DNS record during initial setup. */ @field:[Json(name = "auto_added")] - val autoAdded = false + var autoAdded = false @field:[Json(name = "managed_by_apps")] - val managedByApps = false + var managedByApps = false } diff --git a/src/dorkbox/kloudflareApi/api/dns/UpdateDnsRecord.kt b/src/dorkbox/kloudflareApi/api/dns/UpdateDnsRecord.kt index ad8062a..60afb14 100644 --- a/src/dorkbox/kloudflareApi/api/dns/UpdateDnsRecord.kt +++ b/src/dorkbox/kloudflareApi/api/dns/UpdateDnsRecord.kt @@ -16,11 +16,19 @@ package dorkbox.kloudflareApi.api.dns 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 + * + * 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 diff --git a/src/dorkbox/kloudflareApi/api/firewall/AccessRule.kt b/src/dorkbox/kloudflareApi/api/firewall/AccessRule.kt index 8d59163..c234c45 100644 --- a/src/dorkbox/kloudflareApi/api/firewall/AccessRule.kt +++ b/src/dorkbox/kloudflareApi/api/firewall/AccessRule.kt @@ -16,25 +16,27 @@ package dorkbox.kloudflareApi.api.firewall import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import dorkbox.kloudflareApi.api.core.ISO8601 import java.time.LocalDateTime /** * https://api.cloudflare.com/#user-level-firewall-access-rule-properties */ +@JsonClass(generateAdapter = true) class AccessRule { /** * Access rule identifier tag */ @field:[Json(name = "id")] - val id = "" + var id = "" /** * A personal note about the rule. Typically used as a reminder or explanation for the rule. */ @field:[Json(name = "notes")] - val notes = "" + var notes = "" /** * The possible modes the rule can be in. @@ -42,7 +44,7 @@ class AccessRule { * valid values: block, challenge, whitelist, js_challenge */ @field:[Json(name = "allowed_modes")] - val allowedModes = listOf() + var allowedModes = listOf() /** * The action to apply to a matched request @@ -50,28 +52,28 @@ class AccessRule { * valid values: block, challenge, whitelist, js_challenge */ @field:[Json(name = "mode")] - val mode = "" + var mode = "" /** * Rule configuration */ @field:[Json(name = "configuration")] - val configuration = Configuration() + var configuration = Configuration() @field:[Json(name = "scope")] - val scope = Scope() + var scope = Scope() /** * When the record was last modified */ @field:[Json(name = "modified_on") ISO8601] - var modifiedOn = LocalDateTime.now() + var modifiedOn: LocalDateTime = LocalDateTime.now() /** * When the record was created */ @field:[Json(name = "created_on") ISO8601] - var createdOn = LocalDateTime.now() + var createdOn: LocalDateTime = LocalDateTime.now() override fun equals(other: Any?): Boolean { if (this === other) return true diff --git a/src/dorkbox/kloudflareApi/api/firewall/Configuration.kt b/src/dorkbox/kloudflareApi/api/firewall/Configuration.kt index dd72d50..8ff09dd 100644 --- a/src/dorkbox/kloudflareApi/api/firewall/Configuration.kt +++ b/src/dorkbox/kloudflareApi/api/firewall/Configuration.kt @@ -16,10 +16,12 @@ package dorkbox.kloudflareApi.api.firewall import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** * https://api.cloudflare.com/#user-level-firewall-access-rule-properties */ +@JsonClass(generateAdapter = true) class Configuration { /** @@ -29,7 +31,7 @@ class Configuration { * */ @field:[Json(name = "target")] - val target = "" + var target = "" /** @@ -39,7 +41,7 @@ class Configuration { * COUNTRY : US, DE, etc */ @field:[Json(name = "value")] - val value = "" + var value = "" override fun equals(other: Any?): Boolean { if (this === other) return true diff --git a/src/dorkbox/kloudflareApi/api/firewall/Scope.kt b/src/dorkbox/kloudflareApi/api/firewall/Scope.kt index e1fbada..3115bac 100644 --- a/src/dorkbox/kloudflareApi/api/firewall/Scope.kt +++ b/src/dorkbox/kloudflareApi/api/firewall/Scope.kt @@ -16,23 +16,25 @@ package dorkbox.kloudflareApi.api.firewall import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** * https://api.cloudflare.com/#user-level-firewall-access-rule-properties */ +@JsonClass(generateAdapter = true) class Scope { /** * User identifier tag */ @field:[Json(name = "id")] - val id = "" + var id = "" /** * Your contact email address */ @field:[Json(name = "email")] - val email = "" + var email = "" /** @@ -41,7 +43,7 @@ class Scope { * valid values: user */ @field:[Json(name = "type")] - val type = "user" + var type = "user" override fun equals(other: Any?): Boolean { if (this === other) return true diff --git a/src/dorkbox/kloudflareApi/api/user/BillingHistory.kt b/src/dorkbox/kloudflareApi/api/user/BillingHistory.kt index ca83e5a..8a2e477 100644 --- a/src/dorkbox/kloudflareApi/api/user/BillingHistory.kt +++ b/src/dorkbox/kloudflareApi/api/user/BillingHistory.kt @@ -16,6 +16,7 @@ package dorkbox.kloudflareApi.api.user import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import dorkbox.kloudflareApi.api.core.ISO8601 import dorkbox.kloudflareApi.api.zone.Zone import java.time.LocalDateTime @@ -23,55 +24,56 @@ import java.time.LocalDateTime /** * https://api.cloudflare.com/#user-billing-history-billing-history */ +@JsonClass(generateAdapter = true) class BillingHistory { /** * Billing item identifier tag */ @field:[Json(name = "id")] - val id = "" + var id = "" /** * The billing item type */ @field:[Json(name = "type")] - val type = "charge" + var type = "charge" /** * The billing item action */ @field:[Json(name = "action")] - val action = "subscription" + var action = "subscription" /** * The billing item description */ @field:[Json(name = "description")] - val description = "The billing item description" + var description = "The billing item description" /** * When the billing item was created */ @field:[Json(name = "occurred_at") ISO8601] - val occurredAt= LocalDateTime.now() + var occurredAt: LocalDateTime = LocalDateTime.now() /** * The amount associated with this billing item */ @field:[Json(name = "amount")] - val amount: Double = 20.99 + var amount: Double = 20.99 /** * The monetary unit in which pricing information is displayed */ @field:[Json(name = "currency")] - val currency = "USD" + var currency = "USD" /** * */ @field:[Json(name = "zone")] - val zone = Zone() + var zone = Zone() override fun toString(): String { return "BillingHistory(id='$id', type='$type', action='$action', description='$description', occurredAt=$occurredAt, amount=$amount, currency='$currency', zone=$zone)" diff --git a/src/dorkbox/kloudflareApi/api/user/BillingProfile.kt b/src/dorkbox/kloudflareApi/api/user/BillingProfile.kt index 5e7d139..f559d1c 100644 --- a/src/dorkbox/kloudflareApi/api/user/BillingProfile.kt +++ b/src/dorkbox/kloudflareApi/api/user/BillingProfile.kt @@ -16,140 +16,142 @@ package dorkbox.kloudflareApi.api.user import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import dorkbox.kloudflareApi.api.core.ISO8601 import java.time.LocalDateTime /** * https://api.cloudflare.com/#user-billing-profile-billing-profile */ +@JsonClass(generateAdapter = true) class BillingProfile { /** * The email address associated with this payment type */ @field:[Json(name = "payment_email")] - val paymentEmail = "" + var paymentEmail = "" /** * Billing profile identifier tag */ @field:[Json(name = "id")] - val id = "" + var id = "" /** * The first name on the billing profile */ @field:[Json(name = "first_name")] - val firstName = "" + var firstName = "" /** * The last name on the billing profile */ @field:[Json(name = "last_name")] - val lastName = "" + var lastName = "" /** * Street address on the billing profile */ @field:[Json(name = "address")] - val address = "" + var address = "" /** * Street address continued, apartment/suite, etc (optional) */ @field:[Json(name = "address2")] - val address2 = "" + var address2 = "" /** * The company name on the billing profile */ @field:[Json(name = "company")] - val company = "" + var company = "" /** * The city on the billing profile */ @field:[Json(name = "city")] - val city = "" + var city = "" /** * the state/province on the billing profile */ @field:[Json(name = "state")] - val state = "" + var state = "" /** * The zipcode on the billing profile */ @field:[Json(name = "zipCode")] - val zipcode = "" + var zipcode = "" /** * the country of the address on the billing profile */ @field:[Json(name = "country")] - val country = "" + var country = "" /** * The telephone associated with the billing profile */ @field:[Json(name = "telephone")] - val telephone = "" + var telephone = "" /** * The last four digits of the credit card on file */ @field:[Json(name = "card_number")] - val cardNumber = "" + var cardNumber = "" /** * The month number (1-12) of when the credit card on file expires */ @field:[Json(name = "card_expiry_month")] - val cardExpiryMonth = 1 + var cardExpiryMonth = 1 /** * The year when the credit card on file expires */ @field:[Json(name = "card_expiry_year")] - val cardExpiryYear = 2020 + var cardExpiryYear = 2020 /** - * Value Added Tax ID + * varue Added Tax ID */ @field:[Json(name = "vat")] - val vat = "" + var vat = "" /** * Information about a customer's device collected by client SDK */ @field:[Json(name = "device_data")] - val deviceData = "" + var deviceData = "" /** * The gateway which was used to tokenize the payment method * braintree, paypal */ @field:[Json(name = "payment_gateway")] - val paymentGateway = "" + var paymentGateway = "" /** * The string returned by the client SDK to represent a payment method */ @field:[Json(name = "payment_nonce")] - val paymentNonce = "" + var paymentNonce = "" /** * When the profile was last modified */ @field:[Json(name = "edited_on") ISO8601] - val editedOn = LocalDateTime.now() + var editedOn: LocalDateTime = LocalDateTime.now() /** * When the profile was created */ @field:[Json(name = "created_on") ISO8601] - val createdOn = LocalDateTime.now() + var createdOn: LocalDateTime = LocalDateTime.now() 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)" diff --git a/src/dorkbox/kloudflareApi/api/user/User.kt b/src/dorkbox/kloudflareApi/api/user/User.kt index 52bc982..ebf41ef 100644 --- a/src/dorkbox/kloudflareApi/api/user/User.kt +++ b/src/dorkbox/kloudflareApi/api/user/User.kt @@ -16,97 +16,99 @@ package dorkbox.kloudflareApi.api.user import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import dorkbox.kloudflareApi.api.core.ISO8601 import java.time.LocalDateTime /** * https://api.cloudflare.com/#user-properties */ +@JsonClass(generateAdapter = true) 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. */ @field:[Json(name = "betas")] - val betas = listOf() + var betas = listOf() /** * A list of the organizations the user is a member of (or invited to) and the permissions granted to them. */ @field:[Json(name = "organizations")] - val organizations = listOf() + var organizations = listOf() /** * User's telephone number */ @field:[Json(name = "telephone")] - val telephone: String? = null + var telephone: String? = null /** * The zipcode or postal code where the user lives. */ @field:[Json(name = "zipcode")] - val zipcode: String? = null + var zipcode: String? = null /** * User's last name */ @field:[Json(name = "last_name")] - val lastName: String? = null + var lastName: String? = null /** * Last time the user was modified */ @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 */ @field:[Json(name = "username")] - val userName = "" + var userName = "" /** * When the user signed up. */ @field:[Json(name = "created_on") ISO8601] - val createdOn= LocalDateTime.now() + var createdOn: LocalDateTime = LocalDateTime.now() /** * The country in which the user lives. */ @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 */ @field:[Json(name = "two_factor_authentication_enabled")] - val twoFactorAuthenticationEnabled = false + var twoFactorAuthenticationEnabled = false /** * User's first name */ @field:[Json(name = "first_name")] - val firstName: String? = null + var firstName: String? = null /** * User identifier tag */ @field:[Json(name = "id")] - val id = "" + var id = "" /** * Indicates whether the user is prevented from performing certain actions within their account */ @field:[Json(name = "suspended")] - val suspended = false + var suspended = false /** * Your contact email address */ @field:[Json(name = "email")] - val email = "" + var email = "" 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')" diff --git a/src/dorkbox/kloudflareApi/api/user/UserOrganization.kt b/src/dorkbox/kloudflareApi/api/user/UserOrganization.kt index 913b050..443bef2 100644 --- a/src/dorkbox/kloudflareApi/api/user/UserOrganization.kt +++ b/src/dorkbox/kloudflareApi/api/user/UserOrganization.kt @@ -16,41 +16,43 @@ package dorkbox.kloudflareApi.api.user import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** * https://api.cloudflare.com/#user-s-organizations-list-organizations */ +@JsonClass(generateAdapter = true) class UserOrganization { /** * Organization identifier tag */ @field:[Json(name = "id")] - val id = "" + var id = "" /** * Organization 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")] - val status = "" + var status = "" /** * Access permissions for this User */ @field:[Json(name = "permissions")] - val permissions = listOf() + var permissions = listOf() /** * List of role names for the User at the Organization */ @field:[Json(name = "roles")] - val roles= listOf() + var roles= listOf() override fun toString(): String { return "UserOrganization(id='$id', name='$name', status='$status', permissions=$permissions, roles=$roles)" diff --git a/src/dorkbox/kloudflareApi/api/user/invite/Invite.kt b/src/dorkbox/kloudflareApi/api/user/invite/Invite.kt index 8ad23a3..06d188d 100644 --- a/src/dorkbox/kloudflareApi/api/user/invite/Invite.kt +++ b/src/dorkbox/kloudflareApi/api/user/invite/Invite.kt @@ -16,74 +16,76 @@ package dorkbox.kloudflareApi.api.user.invite import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import dorkbox.kloudflareApi.api.core.ISO8601 import java.time.LocalDateTime /** * https://api.cloudflare.com/#user-s-invites-properties */ +@JsonClass(generateAdapter = true) class Invite { /** * When the invite was sent */ @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 */ @field:[Json(name = "organization_id")] - val organizationId: String? = null + var organizationId: String? = null /** * When the invite is no longer active */ @field:[Json(name = "expires_on")] - val expiresOn: String? = null + var expiresOn: String? = null /** * Current status of the invitation * pending, accepted, rejected, expired */ @field:[Json(name = "status")] - val status = "pending" + var status = "pending" /** * 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 */ @field:[Json(name = "invited_by")] - val invitedBy: String? = null + var invitedBy: String? = null /** * Email address of the user to be added to the Organization */ @field:[Json(name = "invited_member_email")] - val invitedMemberEmail: String? = null + var invitedMemberEmail: String? = null /** * Invite identifier tag */ @field:[Json(name = "id")] - val id = "" + var id = "" /** * Id of the user to be added to the Organization */ @field:[Json(name = "invited_member_id")] - val invitedMemberId: String? = null + var invitedMemberId: String? = null /** * Roles to be assigned to this Member */ @field:[Json(name = "roles")] - val roles = listOf() + var roles = listOf() 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)" diff --git a/src/dorkbox/kloudflareApi/api/user/invite/Role.kt b/src/dorkbox/kloudflareApi/api/user/invite/Role.kt index 6227db4..47ae193 100644 --- a/src/dorkbox/kloudflareApi/api/user/invite/Role.kt +++ b/src/dorkbox/kloudflareApi/api/user/invite/Role.kt @@ -16,37 +16,39 @@ package dorkbox.kloudflareApi.api.user.invite import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** * https://api.cloudflare.com/#user-s-invites-properties */ +@JsonClass(generateAdapter = true) class Role { /** * Role identifier tag */ @field:[Json(name = "id")] - val id = "" + var id = "" /** * Role Name */ @field:[Json(name = "name")] - val name: String? = null + var name: String? = null /** * Description of role's permissions */ @field:[Json(name = "description")] - val description: String? = null + var description: String? = null /** * Access permissions for this User */ @field:[Json(name = "permissions")] - val permissions = listOf() + var permissions = listOf() override fun toString(): String { return "Role(id='$id', name=$name, description=$description, permissions=$permissions)" diff --git a/src/dorkbox/kloudflareApi/api/user/subscription/App.kt b/src/dorkbox/kloudflareApi/api/user/subscription/App.kt index dccd996..bb4ef6c 100644 --- a/src/dorkbox/kloudflareApi/api/user/subscription/App.kt +++ b/src/dorkbox/kloudflareApi/api/user/subscription/App.kt @@ -16,12 +16,14 @@ package dorkbox.kloudflareApi.api.user.subscription import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) class App { /** * app install id */ @field:[Json(name = "install_id")] - val installId = "" + var installId = "" } diff --git a/src/dorkbox/kloudflareApi/api/user/subscription/ComponentValue.kt b/src/dorkbox/kloudflareApi/api/user/subscription/ComponentValue.kt index b2e224c..d529526 100644 --- a/src/dorkbox/kloudflareApi/api/user/subscription/ComponentValue.kt +++ b/src/dorkbox/kloudflareApi/api/user/subscription/ComponentValue.kt @@ -16,33 +16,35 @@ package dorkbox.kloudflareApi.api.user.subscription import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** * https://api.cloudflare.com/#user-subscription-properties */ +@JsonClass(generateAdapter = true) class ComponentValue { /** * The name of the component_value */ @field:[Json(name = "name")] - val name = "" + var name = "" /** * The amount of the component value assigned */ @field:[Json(name = "value")] - val value = 0 + var value = 0 /** * The default amount assigned. */ @field:[Json(name = "default")] - val default = 0 + var default = 0 /** * The unit price for the component value */ @field:[Json(name = "price")] - val price = 0 + var price = 0 } diff --git a/src/dorkbox/kloudflareApi/api/user/subscription/RatePlan.kt b/src/dorkbox/kloudflareApi/api/user/subscription/RatePlan.kt index 039840e..ec96ff8 100644 --- a/src/dorkbox/kloudflareApi/api/user/subscription/RatePlan.kt +++ b/src/dorkbox/kloudflareApi/api/user/subscription/RatePlan.kt @@ -16,53 +16,55 @@ package dorkbox.kloudflareApi.api.user.subscription import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** * https://api.cloudflare.com/#user-subscription-properties */ +@JsonClass(generateAdapter = true) class RatePlan { /** * The ID of the rate_plan */ @field:[Json(name = "id")] - val id = "" + var id = "" /** * The full name of the rate plan */ @field:[Json(name = "public_name")] - val publicName = "" + var publicName = "" /** * The currency applied to the rate_plan subscription */ @field:[Json(name = "currency")] - val currency = "" + var currency = "" /** * The scope that this rate_plan applies to */ @field:[Json(name = "scope")] - val scope = "" + var scope = "" /** * The list of sets this rate_plan applies to */ @field:[Json(name = "sets")] - val sets = listOf() + var sets = listOf() /** * Whether or not a rate_plan is enterprise-based (or newly adopted term contract) */ @field:[Json(name = "is_contract")] - val isContract = false + var isContract = false /** * Whether this rate_plan is managed externally from Cloudflare */ @field:[Json(name = "externally_managed")] - val externallyManaged = false + var externallyManaged = false override fun toString(): String { return "RatePlan(id='$id', publicName='$publicName', currency='$currency', scope='$scope', sets=$sets, isContract=$isContract, externallyManaged=$externallyManaged)" diff --git a/src/dorkbox/kloudflareApi/api/user/subscription/Subscription.kt b/src/dorkbox/kloudflareApi/api/user/subscription/Subscription.kt index 8c9e31e..04d5a67 100644 --- a/src/dorkbox/kloudflareApi/api/user/subscription/Subscription.kt +++ b/src/dorkbox/kloudflareApi/api/user/subscription/Subscription.kt @@ -16,6 +16,7 @@ package dorkbox.kloudflareApi.api.user.subscription import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import dorkbox.kloudflareApi.api.core.ISO8601 import dorkbox.kloudflareApi.api.zone.Zone import java.time.LocalDateTime @@ -23,55 +24,56 @@ import java.time.LocalDateTime /** * https://api.cloudflare.com/#user-subscription-properties */ +@JsonClass(generateAdapter = true) class Subscription { /** * The end of the current period, and also when the next billing is due */ @field:[Json(name = "app")] - val app = App() + var app = App() /** * The end of the current period, and also when the next billing is due */ @field:[Json(name = "current_period_end") ISO8601] - val currentPeriodEnd= LocalDateTime.now() + var currentPeriodEnd: LocalDateTime = LocalDateTime.now() /** * The list of add-ons subscribed to */ @field:[Json(name = "component_values")] - val componentValues = listOf() + var componentValues = listOf() /** * The rate plan applied to the subscription */ @field:[Json(name = "rate_plan")] - val ratePlan = RatePlan() + var ratePlan = RatePlan() /** * The price of the subscription that will be billed, in US dollars */ @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 */ @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. */ @field:[Json(name = "zone")] - val zone = Zone() + var zone = Zone() /** * The monetary unit in which pricing information is displayed */ @field:[Json(name = "currency")] - val currency = "USD" + var currency = "USD" /** * The state that the subscription is in @@ -79,13 +81,13 @@ class Subscription { * Trial, Provisioned, Paid, AwaitingPayment, Cancelled, Failed, Expired */ @field:[Json(name = "state")] - val state = "Expired" + var state = "Expired" /** * Subscription identifier tag */ @field:[Json(name = "id")] - val id = "" + var id = "" /** * How often the subscription is renewed automatically @@ -93,7 +95,7 @@ class Subscription { * weekly, monthly, quarterly, yearly */ @field:[Json(name = "frequency")] - val frequency = "weekly" + var frequency = "weekly" 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')" diff --git a/src/dorkbox/kloudflareApi/api/zone/Account.kt b/src/dorkbox/kloudflareApi/api/zone/Account.kt index c099904..0ea5893 100644 --- a/src/dorkbox/kloudflareApi/api/zone/Account.kt +++ b/src/dorkbox/kloudflareApi/api/zone/Account.kt @@ -16,23 +16,25 @@ package dorkbox.kloudflareApi.api.zone import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** * https://api.cloudflare.com/#zone-properties */ +@JsonClass(generateAdapter = true) class Account { /** * Account identifier tag */ @field:[Json(name = "id")] - val id = "" + var id = "" /** * Account name */ @field:[Json(name = "name")] - val name = "" + var name = "" override fun toString(): String { return "Account(id='$id', name='$name')" diff --git a/src/dorkbox/kloudflareApi/api/zone/Component.kt b/src/dorkbox/kloudflareApi/api/zone/Component.kt index f881b43..7d572e9 100644 --- a/src/dorkbox/kloudflareApi/api/zone/Component.kt +++ b/src/dorkbox/kloudflareApi/api/zone/Component.kt @@ -16,10 +16,12 @@ package dorkbox.kloudflareApi.api.zone import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** * https://api.cloudflare.com/#zone-properties */ +@JsonClass(generateAdapter = true) class Component { /** @@ -27,19 +29,19 @@ class Component { * zones, page_rules, dedicated_certificates, dedicated_certificates_custom */ @field:[Json(name = "name")] - val name: String? = null + var name: String? = null /** * The default amount allocated */ @field:[Json(name = "default")] - val default = 5 + var default = 5 /** * The unit price of the addon */ @field:[Json(name = "unit_price")] - val unitPrice = 0 + var unitPrice = 0 override fun toString(): String { return "Components(name=$name, default=$default, unitPrice=$unitPrice)" diff --git a/src/dorkbox/kloudflareApi/api/zone/Owner.kt b/src/dorkbox/kloudflareApi/api/zone/Owner.kt index 0d312bb..c702829 100644 --- a/src/dorkbox/kloudflareApi/api/zone/Owner.kt +++ b/src/dorkbox/kloudflareApi/api/zone/Owner.kt @@ -16,23 +16,25 @@ package dorkbox.kloudflareApi.api.zone import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** * https://api.cloudflare.com/#zone-properties */ +@JsonClass(generateAdapter = true) class Owner { @field:[Json(name = "id")] - val id = "" + var id = "" /** * The type of owner of the zone */ @field:[Json(name = "email")] - val email = "" + var email = "" @field:[Json(name = "owner_type")] - val ownerType = "user" + var ownerType = "user" override fun toString(): String { return "Owner(id='$id', email='$email', ownerType='$ownerType')" diff --git a/src/dorkbox/kloudflareApi/api/zone/Plan.kt b/src/dorkbox/kloudflareApi/api/zone/Plan.kt index fce73d5..adcb52d 100644 --- a/src/dorkbox/kloudflareApi/api/zone/Plan.kt +++ b/src/dorkbox/kloudflareApi/api/zone/Plan.kt @@ -16,61 +16,63 @@ package dorkbox.kloudflareApi.api.zone import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** * https://api.cloudflare.com/#zone-properties */ +@JsonClass(generateAdapter = true) class Plan { /** * Plan identifier tag */ @field:[Json(name = "id")] - val id = "" + var id = "" /** * The plan 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 */ @field:[Json(name = "price")] - val price = 0 + var price = 0 /** * The monetary unit in which pricing information is displayed */ @field:[Json(name = "currency")] - val currency = "USD" + var currency = "USD" /** * The frequency at which you will be billed for this plan * weekly, monthly, quarterly, yearly */ @field:[Json(name = "frequency")] - val frequency = "weekly" + var frequency = "weekly" /** * A 'friendly' identifier to indicate to the UI what plan the object is * free, pro, business, enterprise */ @field:[Json(name = "legacy_id")] - val legacyId = "free" + var legacyId = "free" /** * If the zone is subscribed to this plan */ @field:[Json(name = "is_subscribed")] - val isSubscribed = false + var isSubscribed = false /** * If the zone is allowed to subscribe to this plan */ @field:[Json(name = "can_subscribe")] - val canSubscribe = false + var canSubscribe = false override fun toString(): String { return "Plan(id='$id', name=$name, price=$price, currency='$currency', frequency='$frequency', legacyId='$legacyId', isSubscribed=$isSubscribed, canSubscribe=$canSubscribe)" diff --git a/src/dorkbox/kloudflareApi/api/zone/PlanPending.kt b/src/dorkbox/kloudflareApi/api/zone/PlanPending.kt index a77a97c..c991375 100644 --- a/src/dorkbox/kloudflareApi/api/zone/PlanPending.kt +++ b/src/dorkbox/kloudflareApi/api/zone/PlanPending.kt @@ -16,61 +16,63 @@ package dorkbox.kloudflareApi.api.zone import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** * https://api.cloudflare.com/#zone-properties */ +@JsonClass(generateAdapter = true) class PlanPending { /** * Plan identifier tag */ @field:[Json(name = "id")] - val id = "" + var id = "" /** * The plan name */ @field:[Json(name = "name")] - val name = "" + var name = "" /** * The price of the subscription that will be billed, in US dollars */ @field:[Json(name = "price")] - val price = 0 + var price = 0 /** * The monetary unit in which pricing information is displayed */ @field:[Json(name = "currency")] - val currency = "USD" + var currency = "USD" /** * The frequency at which you will be billed for this plan * weekly, monthly, quarterly, yearly */ @field:[Json(name = "frequency")] - val frequency = "weekly" + var frequency = "weekly" /** * A 'friendly' identifier to indicate to the UI what plan the object is * free, pro, business, enterprise */ @field:[Json(name = "legacy_id")] - val legacyId = "free" + var legacyId = "free" /** * If the zone is subscribed to this plan */ @field:[Json(name = "is_subscribed")] - val isSubscribed = false + var isSubscribed = false /** * If the zone is allowed to subscribe to this plan */ @field:[Json(name = "can_subscribe")] - val canSubscribe = false + var canSubscribe = false override fun toString(): String { return "PlanPending(id='$id', name='$name', price=$price, currency='$currency', frequency='$frequency', legacyId='$legacyId', isSubscribed=$isSubscribed, canSubscribe=$canSubscribe)" diff --git a/src/dorkbox/kloudflareApi/api/zone/RatePlan.kt b/src/dorkbox/kloudflareApi/api/zone/RatePlan.kt index 60e411b..d2bdbe5 100644 --- a/src/dorkbox/kloudflareApi/api/zone/RatePlan.kt +++ b/src/dorkbox/kloudflareApi/api/zone/RatePlan.kt @@ -16,48 +16,50 @@ package dorkbox.kloudflareApi.api.zone import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** * https://api.cloudflare.com/#zone-rate-plan-properties */ -class RatePlan { +@JsonClass(generateAdapter = true) +class RatePlan { /** * Plan identifier tag */ @field:[Json(name = "id")] - val id = "free" + var id = "free" /** * The plan name */ @field:[Json(name = "name")] - val name = "Free Plan" + var name = "Free Plan" /** * The monetary unit in which pricing information is displayed */ @field:[Json(name = "currency")] - val currency = "USD" + var currency = "USD" /** * The duration of the plan subscription */ @field:[Json(name = "duration")] - val duration = 1 + var duration = 1 /** * The frequency at which you will be billed for this plan * weekly, monthly, quarterly, yearly */ @field:[Json(name = "frequency")] - val frequency = "monthly" + var frequency = "monthly" /** * Array of available components values for the plan */ @field:[Json(name = "components")] - val components = listOf() + var components = listOf() override fun toString(): String { return "RatePlan(id='$id', name='$name', currency='$currency', duration=$duration, frequency='$frequency', components=$components)" diff --git a/src/dorkbox/kloudflareApi/api/zone/Zone.kt b/src/dorkbox/kloudflareApi/api/zone/Zone.kt index fe65882..403d908 100644 --- a/src/dorkbox/kloudflareApi/api/zone/Zone.kt +++ b/src/dorkbox/kloudflareApi/api/zone/Zone.kt @@ -16,6 +16,7 @@ package dorkbox.kloudflareApi.api.zone import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import dorkbox.kloudflareApi.Kloudflare import dorkbox.kloudflareApi.api.core.ISO8601 import dorkbox.kloudflareApi.api.dns.DnsRecord @@ -24,6 +25,7 @@ import java.time.LocalDateTime /** * https://api.cloudflare.com/#zone-properties */ +@JsonClass(generateAdapter = true) class Zone { /** @@ -43,111 +45,111 @@ class Zone { @field:[Json(name = "id")] - val id: String = "" + var id: String = "" /** * The domain 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. */ @field:[Json(name = "development_mode")] - val developmentMode = 0 + var developmentMode = 0 /** * Original name servers before moving to Cloudflare */ @field:[Json(name = "original_name_servers")] - val originalNameServers: List? = null + var originalNameServers: List? = null /** * Registrar for the domain at the time of switching to Cloudflare */ @field:[Json(name = "original_registrar")] - val originalRegistrar: String? = null + var originalRegistrar: String? = null /** * DNS host at the time of switching to Cloudflare */ @field:[Json(name = "original_dnshost")] - val originalDnshost: String? = null + var originalDnshost: String? = null /** * When the zone was created */ @field:[Json(name = "created_on") ISO8601] - val createdOn = LocalDateTime.now() + var createdOn: LocalDateTime = LocalDateTime.now() /** * When the zone was last modified */ @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 */ @field:[Json(name = "name_servers")] - val nameServers = listOf() + var nameServers = listOf() /** * Information about the owner of the zone */ @field:[Json(name = "owner")] - val owner = Owner() + var owner = Owner() /** * Information about the account the zone belongs to */ @field:[Json(name = "account")] - val account = Account() + var account = Account() /** * Available permissions on the zone for the current user requesting the item */ @field:[Json(name = "permissions")] - val permissions = listOf() + var permissions = listOf() /** * A zone plan */ @field:[Json(name = "plan")] - val plan = Plan() + var plan = Plan() /** * A zone plan */ @field:[Json(name = "plan_pending")] - val planPending = PlanPending() + var planPending = PlanPending() /** * Status of the zone * active, pending, initializing, moved, deleted, deactivated */ @field:[Json(name = "status")] - val status = "active" + var status = "active" /** * The last time proof of ownership was detected and the zone was made active */ @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. */ @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. * full, partial */ @field:[Json(name = "type")] - val type = "full" + var type = "full" 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')" diff --git a/src/dorkbox/kloudflareApi/api/zone/settings/MinifyAssetsSetting.kt b/src/dorkbox/kloudflareApi/api/zone/settings/MinifyAssetsSetting.kt index f8b0d8f..eef7284 100644 --- a/src/dorkbox/kloudflareApi/api/zone/settings/MinifyAssetsSetting.kt +++ b/src/dorkbox/kloudflareApi/api/zone/settings/MinifyAssetsSetting.kt @@ -16,28 +16,30 @@ package dorkbox.kloudflareApi.api.zone.settings import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) class MinifyAssetsSetting { /** * Account identifier tag * on, off */ @field:[Json(name = "css")] - val css = "" + var css = "" /** * Account identifier tag * on, off */ @field:[Json(name = "html")] - val html = "" + var html = "" /** * Account identifier tag * on, off */ @field:[Json(name = "js")] - val js = "" + var js = "" override fun toString(): String { return "MinifyAssets(css='$css', html='$html', js='$js')" diff --git a/src/dorkbox/kloudflareApi/api/zone/settings/MobileRedirectSetting.kt b/src/dorkbox/kloudflareApi/api/zone/settings/MobileRedirectSetting.kt index 58bbe9e..7b90b66 100644 --- a/src/dorkbox/kloudflareApi/api/zone/settings/MobileRedirectSetting.kt +++ b/src/dorkbox/kloudflareApi/api/zone/settings/MobileRedirectSetting.kt @@ -16,31 +16,31 @@ package dorkbox.kloudflareApi.api.zone.settings import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) class MobileRedirectSetting { /** * Whether or not the mobile redirection is enabled * on, off */ @field:[Json(name = "status")] - val status = "" + var status = "" /** * Which subdomain prefix you wish to redirect visitors on mobile devices to (subdomain must already exist). */ @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 * on, off */ @field:[Json(name = "strip_uri")] - val strip_uri = false + var strip_uri = false override fun toString(): String { return "MobileRedirectSetting(status='$status', mobileSubdomain=$mobileSubdomain, strip_uri=$strip_uri)" } - - } diff --git a/src/dorkbox/kloudflareApi/api/zone/settings/SecurityHeadingSetting.kt b/src/dorkbox/kloudflareApi/api/zone/settings/SecurityHeadingSetting.kt index 2c8478c..b650d69 100644 --- a/src/dorkbox/kloudflareApi/api/zone/settings/SecurityHeadingSetting.kt +++ b/src/dorkbox/kloudflareApi/api/zone/settings/SecurityHeadingSetting.kt @@ -16,7 +16,9 @@ package dorkbox.kloudflareApi.api.zone.settings import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) class SecurityHeadingSetting { /** * Whether or not strict transport security is enabled diff --git a/src/dorkbox/kloudflareApi/api/zone/settings/ZoneSetting.kt b/src/dorkbox/kloudflareApi/api/zone/settings/ZoneSetting.kt index 369c6dd..88bf8e3 100644 --- a/src/dorkbox/kloudflareApi/api/zone/settings/ZoneSetting.kt +++ b/src/dorkbox/kloudflareApi/api/zone/settings/ZoneSetting.kt @@ -16,19 +16,21 @@ package dorkbox.kloudflareApi.api.zone.settings import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import dorkbox.kloudflareApi.api.core.ISO8601 import java.time.LocalDateTime /** * Always Online Mode */ +@JsonClass(generateAdapter = true) class AlwaysOnline : ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "AlwaysOnline(value='$value')" + super.toString() @@ -38,6 +40,7 @@ class AlwaysOnline : ZoneSetting() { /** * Advanced DDoS Protection */ +@JsonClass(generateAdapter = true) class AdvancedDDos : ZoneSetting() { /** * Value of the zone setting @@ -45,7 +48,7 @@ class AdvancedDDos : ZoneSetting() { * on, off */ @field:[Json(name = "value")] - val value = "off" + var value = "off" override fun toString(): String { return "AdvancedDDos(value='$value')" + super.toString() @@ -55,13 +58,14 @@ class AdvancedDDos : ZoneSetting() { /** * Brotli Compression */ +@JsonClass(generateAdapter = true) class Brotli : ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "Brotli(value='$value')" + super.toString() @@ -71,6 +75,7 @@ class Brotli : ZoneSetting() { /** * Browser Cache TTL */ +@JsonClass(generateAdapter = true) class BrowserCacheTtl : ZoneSetting() { /** * 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) */ @field:[Json(name = "value")] - val value = 14400 + var value = 14400 override fun toString(): String { return "BrowserCacheTtl(value=$value)" + super.toString() @@ -91,13 +96,14 @@ class BrowserCacheTtl : ZoneSetting() { /** * Browser Check */ +@JsonClass(generateAdapter = true) class BrowserCheck : ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "BrowserCheck(value='$value')" + super.toString() @@ -108,13 +114,14 @@ class BrowserCheck : ZoneSetting() { /** * Cloudflare CNAME Flattening */ +@JsonClass(generateAdapter = true) class FlattenAtRoot: ZoneSetting() { /** * Value of the zone setting * flatten_at_root, flatten_all */ @field:[Json(name = "value")] - val value = "flatten_at_root" + var value = "flatten_at_root" override fun toString(): String { return "FlattenAtRoot(value='$value')" + super.toString() @@ -125,13 +132,14 @@ class FlattenAtRoot: ZoneSetting() { /** * Cloudflare Cache Level */ +@JsonClass(generateAdapter = true) class CacheLevel: ZoneSetting() { /** * Value of the zone setting * aggressive, basic, simplified */ @field:[Json(name = "value")] - val value = "aggressive" + var value = "aggressive" override fun toString(): String { return "CacheLevel(value='$value')" + super.toString() @@ -141,6 +149,7 @@ class CacheLevel: ZoneSetting() { /** * Challenge Page TTL */ +@JsonClass(generateAdapter = true) class ChallengePageTtl: ZoneSetting() { /** * 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 */ @field:[Json(name = "value")] - val value = 1800 + var value = 1800 override fun toString(): String { return "ChallengePageTtl(value=$value)" + super.toString() @@ -158,13 +167,14 @@ class ChallengePageTtl: ZoneSetting() { /** * Development Mode */ +@JsonClass(generateAdapter = true) class DevelopmentMode: ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" /** * 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. */ @field:[Json(name = "time_remaining")] - val timeRemaining = 0 + var timeRemaining = 0 override fun toString(): String { return "DevelopmentMode(value='$value', timeRemaining=$timeRemaining)" + super.toString() @@ -183,6 +193,7 @@ class DevelopmentMode: ZoneSetting() { /** * Edge Cache TTL */ +@JsonClass(generateAdapter = true) class EdgeCacheTtl: ZoneSetting() { /** * 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) */ @field:[Json(name = "value")] - val value = 1800 + var value = 1800 override fun toString(): String { return "EdgeCacheTtl(value=$value)" + super.toString() @@ -202,13 +213,14 @@ class EdgeCacheTtl: ZoneSetting() { /** * Error Pages On */ +@JsonClass(generateAdapter = true) class ErrorPagesOn: ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "ErrorPagesOn(value='$value')" + super.toString() @@ -219,13 +231,14 @@ class ErrorPagesOn: ZoneSetting() { /** * Get String Sort */ +@JsonClass(generateAdapter = true) class StringSort: ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "StringSort(value='$value')" + super.toString() @@ -235,13 +248,14 @@ class StringSort: ZoneSetting() { /** * Email Obfuscation */ +@JsonClass(generateAdapter = true) class EmailObfuscation: ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "EmailObfuscation(value='$value')" + super.toString() @@ -251,13 +265,14 @@ class EmailObfuscation: ZoneSetting() { /** * Hotlink Protection */ +@JsonClass(generateAdapter = true) class HotlinkProtection: ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "HotlinkProtection(value='$value')" + super.toString() @@ -267,13 +282,14 @@ class HotlinkProtection: ZoneSetting() { /** * IP Geolocation */ +@JsonClass(generateAdapter = true) class IpGeolocation: ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "IpGeolocation(value='$value')" + super.toString() @@ -283,13 +299,14 @@ class IpGeolocation: ZoneSetting() { /** * IPv6 */ +@JsonClass(generateAdapter = true) class IPv6: ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "IPv6(value='$value')" + super.toString() @@ -299,13 +316,14 @@ class IPv6: ZoneSetting() { /** * WebSockets */ +@JsonClass(generateAdapter = true) class Websockets: ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "Websockets(value='$value')" + super.toString() @@ -315,13 +333,14 @@ class Websockets: ZoneSetting() { /** * Toggle SHA1 support */ +@JsonClass(generateAdapter = true) class ToggleSha1: ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "ToggleSha1(value='$value')" + super.toString() @@ -331,13 +350,14 @@ class ToggleSha1: ZoneSetting() { /** * TLS1.2 Only */ +@JsonClass(generateAdapter = true) class Tls1_2Only: ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "Tls1_2Only(value='$value')" + super.toString() @@ -347,13 +367,14 @@ class Tls1_2Only: ZoneSetting() { /** * Auto-Minify Assets */ +@JsonClass(generateAdapter = true) class AutoMinify: ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = MinifyAssetsSetting() + var value = MinifyAssetsSetting() override fun toString(): String { return "AutoMinify(value=$value)" + super.toString() @@ -363,6 +384,7 @@ class AutoMinify: ZoneSetting() { /** * Max Upload */ +@JsonClass(generateAdapter = true) class MaxUpload: ZoneSetting() { /** * 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) */ @field:[Json(name = "value")] - val value = 100 + var value = 100 override fun toString(): String { return "MaxUpload(value=$value)" + super.toString() @@ -381,13 +403,14 @@ class MaxUpload: ZoneSetting() { /** * Mobile Redirect */ +@JsonClass(generateAdapter = true) class MobileRedirect: ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = MobileRedirectSetting() + var value = MobileRedirectSetting() override fun toString(): String { return "MobileRedirect(value=$value)" + super.toString() @@ -397,13 +420,14 @@ class MobileRedirect: ZoneSetting() { /** * Mirage Image Optimization */ +@JsonClass(generateAdapter = true) class Mirage: ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "Mirage(value='$value')" + super.toString() @@ -413,13 +437,14 @@ class Mirage: ZoneSetting() { /** * Polish Image Optimization */ +@JsonClass(generateAdapter = true) class PolishImage: ZoneSetting() { /** * Value of the zone setting * off, lossless, lossy */ @field:[Json(name = "value")] - val value = "off" + var value = "off" override fun toString(): String { return "PolishImage(value='$value')" + super.toString() @@ -429,13 +454,14 @@ class PolishImage: ZoneSetting() { /** * Polish WebP Conversion */ +@JsonClass(generateAdapter = true) class PolishWebP: ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "PolishWebP(value='$value')" + super.toString() @@ -445,13 +471,14 @@ class PolishWebP: ZoneSetting() { /** * Prefetch Preload */ +@JsonClass(generateAdapter = true) class PrefetchPreload: ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "PrefetchPreload(value='$value')" + super.toString() @@ -461,13 +488,14 @@ class PrefetchPreload: ZoneSetting() { /** * Privacy Pass */ +@JsonClass(generateAdapter = true) class PrivatePass: ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "PrivatePass(value='$value')" + super.toString() @@ -477,13 +505,14 @@ class PrivatePass: ZoneSetting() { /** * Response Buffering */ +@JsonClass(generateAdapter = true) class ReponseBuffering: ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "ReponseBuffering(value='$value')" + super.toString() @@ -493,13 +522,14 @@ class ReponseBuffering: ZoneSetting() { /** * Rocket Loader */ +@JsonClass(generateAdapter = true) class RocketLoader: ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "RocketLoader(value='$value')" + super.toString() @@ -509,12 +539,13 @@ class RocketLoader: ZoneSetting() { /** * Security Header */ +@JsonClass(generateAdapter = true) class SecurityHeader: ZoneSetting() { /** * Current value of the zone setting */ @field:[Json(name = "value")] - val value = SecurityHeadingSetting() + var value = SecurityHeadingSetting() override fun toString(): String { return "SecurityHeader(value=$value)" + super.toString() @@ -524,13 +555,14 @@ class SecurityHeader: ZoneSetting() { /** * Security Level */ +@JsonClass(generateAdapter = true) class SecurityLevel: ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = SecurityHeadingSetting() + var value = SecurityHeadingSetting() override fun toString(): String { return "SecurityLevel(value=$value)" + super.toString() @@ -540,13 +572,14 @@ class SecurityLevel: ZoneSetting() { /** * Server Side Exclude */ +@JsonClass(generateAdapter = true) class ServerSideExclude: ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "ServerSideExclude(value='$value')" + super.toString() @@ -556,6 +589,7 @@ class ServerSideExclude: ZoneSetting() { /** * SSL */ +@JsonClass(generateAdapter = true) class SSL: ZoneSetting() { /** * Value of the zone setting @@ -564,7 +598,7 @@ class SSL: ZoneSetting() { * notes: Depends on the zone's plan level */ @field:[Json(name = "value")] - val value = "off" + var value = "off" override fun toString(): String { return "SSL(value='$value')" + super.toString() @@ -574,6 +608,7 @@ class SSL: ZoneSetting() { /** * TLS Client Authentication */ +@JsonClass(generateAdapter = true) class TlsClientAuth: ZoneSetting() { /** * Value of the zone setting @@ -582,7 +617,7 @@ class TlsClientAuth: ZoneSetting() { * notes: Depends on the zone's plan level */ @field:[Json(name = "value")] - val value = "off" + var value = "off" override fun toString(): String { return "TlsClientAuth(value='$value')" + super.toString() @@ -592,6 +627,7 @@ class TlsClientAuth: ZoneSetting() { /** * True Client IP Header */ +@JsonClass(generateAdapter = true) class TrueClientIPHeader: ZoneSetting() { /** * Value of the zone setting @@ -600,7 +636,7 @@ class TrueClientIPHeader: ZoneSetting() { * notes: Depends on the zone's plan level */ @field:[Json(name = "value")] - val value = "off" + var value = "off" override fun toString(): String { return "TrueClientIPHeader(value='$value')" + super.toString() @@ -610,13 +646,14 @@ class TrueClientIPHeader: ZoneSetting() { /** * Web Application Firewall */ +@JsonClass(generateAdapter = true) class WebApplicationFirewall: ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "WebApplicationFirewall(value='$value')" + super.toString() @@ -627,13 +664,14 @@ class WebApplicationFirewall: ZoneSetting() { /** * Zone Minimum TLS Version Value */ +@JsonClass(generateAdapter = true) class ZoneMinimumTLSVersionValue: ZoneSetting() { /** * Value of the zone setting * 1.0, 1.1, 1.2, 1.3 */ @field:[Json(name = "value")] - val value = 1.0 + var value = 1.0 override fun toString(): String { return "ZoneMinimumTLSVersionValue(value=$value)" + super.toString() @@ -644,13 +682,14 @@ class ZoneMinimumTLSVersionValue: ZoneSetting() { /** * Zone Enable TLS 1.3 */ +@JsonClass(generateAdapter = true) class ZoneEnableTLS1_3: ZoneSetting() { /** * Value of the zone setting * on, off, zrt */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "ZoneEnableTLS1_3(value='$value')" + super.toString() @@ -660,13 +699,14 @@ class ZoneEnableTLS1_3: ZoneSetting() { /** * Zone Enable Opportunistic Encryption */ +@JsonClass(generateAdapter = true) class ZoneEnableOpportunisticEncryption : ZoneSetting() { /** * Value of the zone setting * on, off, zrt */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "ZoneEnableOpportunisticEncryption(value='$value')" + super.toString() @@ -676,13 +716,14 @@ class ZoneEnableOpportunisticEncryption : ZoneSetting() { /** * Zone Enable Automatic HTTPS Rewrites */ +@JsonClass(generateAdapter = true) class ZoneEnableAutomaticHTTPSRewrites : ZoneSetting() { /** * Value of the zone setting * on, off, zrt */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "ZoneEnableAutomaticHTTPSRewrites(value='$value')" + super.toString() @@ -692,13 +733,14 @@ class ZoneEnableAutomaticHTTPSRewrites : ZoneSetting() { /** * HTTP2 */ +@JsonClass(generateAdapter = true) class HTTP2 : ZoneSetting() { /** * Value of the zone setting * on, off, zrt */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "HTTP2(value='$value')" + super.toString() @@ -708,13 +750,14 @@ class HTTP2 : ZoneSetting() { /** * Pseudo IPv4 Value */ +@JsonClass(generateAdapter = true) class PseudoIPv4 : ZoneSetting() { /** * Value of the zone setting * off, add_header, overwrite_header */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "PseudoIPv4(value='$value')" + super.toString() @@ -724,13 +767,14 @@ class PseudoIPv4 : ZoneSetting() { /** * Zone Enable Always Use HTTPS */ +@JsonClass(generateAdapter = true) class ZoneEnableAlwaysUseHTTPS : ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "ZoneEnableAlwaysUseHTTPS(value='$value')" + super.toString() @@ -740,13 +784,14 @@ class ZoneEnableAlwaysUseHTTPS : ZoneSetting() { /** * Zone Enable Onion Routing */ +@JsonClass(generateAdapter = true) class ZoneEnableOnionRouting : ZoneSetting() { /** * Value of the zone setting * on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "ZoneEnableOnionRouting(value='$value')" + super.toString() @@ -756,13 +801,14 @@ class ZoneEnableOnionRouting : ZoneSetting() { /** * Image Resizing */ +@JsonClass(generateAdapter = true) class ImageResizing : ZoneSetting() { /** * Value of the zone setting *on, off */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "ImageResizing(value='$value')" + super.toString() @@ -772,13 +818,14 @@ class ImageResizing : ZoneSetting() { /** * HTTP/2 Edge Prioritization */ +@JsonClass(generateAdapter = true) class HTTP2EdgePrioritization : ZoneSetting() { /** * Value of the zone setting * on, off, custom */ @field:[Json(name = "value")] - val value = "on" + var value = "on" override fun toString(): String { return "HTTP2EdgePrioritization(value='$value')" + super.toString() @@ -790,6 +837,7 @@ class HTTP2EdgePrioritization : ZoneSetting() { /** * https://api.cloudflare.com/#zone-settings-properties */ +@JsonClass(generateAdapter = true) 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 */ @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) */ @field:[Json(name = "editable")] - val editable = true + var editable = true /** * last time this setting was modified */ @field:[Json(name = "modified_on") ISO8601] - val modifiedOn: LocalDateTime? = null + var modifiedOn: LocalDateTime? = null override fun toString(): String { return "ZoneSetting(id='$id', editable=$editable, modifiedOn=$modifiedOn)"