fix pdns api clients (retry 16x)

reflect-config.json add
This commit is contained in:
dalbodeule
2024-06-07 13:35:35 +09:00
parent 9a406f1b3e
commit bc537299e5
5 changed files with 18 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
package space.mori.dnsapi
import com.google.gson.Gson
import com.google.gson.annotations.SerializedName
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.Request
@@ -126,7 +127,11 @@ class PowerDNSAPIClient() {
}
}
class PowerDNSAPIError(val error: String, val errors: List<String>)
@ReflectiveAccess
data class PowerDNSAPIError(
@SerializedName("error") val error: String,
@SerializedName("errors") val errors: List<String>
)
class PowerDNSAPIException(private val error: PowerDNSAPIError): RuntimeException(error.error) {
val errors: List<String>
get() = error.errors

View File

@@ -0,0 +1,5 @@
package space.mori.dnsapi
@Target(AnnotationTarget.CLASS, AnnotationTarget.FIELD, AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.RUNTIME)
annotation class ReflectiveAccess

View File

@@ -1,8 +0,0 @@
[
{
"name": "space.mori.dnsapi.PowerDNSAPIError",
"allDeclaredConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true
}
]