org.http4k.webhook.WebhookTimestamp.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of http4k-webhook Show documentation
Show all versions of http4k-webhook Show documentation
Http4k Standard webhooks support
package org.http4k.webhook
import dev.forkhandles.values.LongValue
import dev.forkhandles.values.LongValueFactory
import dev.forkhandles.values.minValue
import java.time.Instant
class WebhookTimestamp private constructor(value: Long) : LongValue(value) {
fun asInstant() = Instant.ofEpochSecond(value)
companion object : LongValueFactory(::WebhookTimestamp, 0L.minValue) {
fun of(instant: Instant) = of(instant.epochSecond)
}
}