src.main.kotlin.com.gabrielfeo.develocity.api.model.TestIncludeFields.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of develocity-api-kotlin Show documentation
Show all versions of develocity-api-kotlin Show documentation
A library to use the Develocity API in Kotlin
The newest version!
/**
*
* Please note:
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* Do not edit this file manually.
*
*/
@file:Suppress(
"ArrayInDataClass",
"EnumEntryName",
"RemoveRedundantQualifierName",
"UnusedImport"
)
package com.gabrielfeo.develocity.api.model
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
/**
*
*
* Values: BUILD_SCAN_IDS,WORK_UNITS
*/
@JsonClass(generateAdapter = false)
enum class TestIncludeFields(val value: kotlin.String) {
@Json(name = "buildScanIds")
BUILD_SCAN_IDS("buildScanIds"),
@Json(name = "workUnits")
WORK_UNITS("workUnits");
/**
* Override [toString()] to avoid using the enum variable name as the value, and instead use
* the actual value defined in the API spec file.
*
* This solves a problem when the variable name and its value are different, and ensures that
* the client sends the correct enum values to the server always.
*/
override fun toString(): kotlin.String = value
companion object {
/**
* Converts the provided [data] to a [String] on success, null otherwise.
*/
fun encode(data: kotlin.Any?): kotlin.String? = if (data is TestIncludeFields) "$data" else null
/**
* Returns a valid [TestIncludeFields] for [data], null otherwise.
*/
fun decode(data: kotlin.Any?): TestIncludeFields? = data?.let {
val normalizedData = "$it".lowercase()
values().firstOrNull { value ->
it == value || normalizedData == "$value".lowercase()
}
}
}
}