-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
70 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 9 additions & 1 deletion
10
shared/src/main/kotlin/com/egm/stellio/shared/queryparameter/FormatValue.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
package com.egm.stellio.shared.queryparameter | ||
|
||
import arrow.core.Either | ||
import arrow.core.left | ||
import arrow.core.raise.either | ||
import com.egm.stellio.shared.model.APIException | ||
import com.egm.stellio.shared.model.InvalidRequestException | ||
|
||
enum class FormatValue(val value: String) { | ||
KEY_VALUES("keyValues"), | ||
SIMPLIFIED("simplified"), | ||
NORMALIZED("normalized"), | ||
TEMPORAL_VALUES("temporalValues"), | ||
AGGREGATED_VALUES("aggregatedValues"); | ||
companion object { | ||
fun fromString(key: String): FormatValue? = | ||
fun fromString(key: String): Either<APIException, FormatValue> = either { | ||
FormatValue.entries.find { it.value == key } | ||
?: return InvalidRequestException("'$key' is not a valid value for the format query parameter").left() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.