2022-01-15 18:40:38 -05:00
|
|
|
package io.heckel.ntfy.msg
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.Keep
|
2022-04-16 20:12:40 -04:00
|
|
|
import io.heckel.ntfy.db.Action
|
2022-01-15 18:40:38 -05:00
|
|
|
|
|
|
|
|
/* This annotation ensures that proguard still works in production builds,
|
|
|
|
|
* see https://stackoverflow.com/a/62753300/1440785 */
|
|
|
|
|
@Keep
|
|
|
|
|
data class Message(
|
|
|
|
|
val id: String,
|
|
|
|
|
val time: Long,
|
|
|
|
|
val event: String,
|
|
|
|
|
val topic: String,
|
|
|
|
|
val priority: Int?,
|
|
|
|
|
val tags: List<String>?,
|
|
|
|
|
val click: String?,
|
2022-04-16 20:12:40 -04:00
|
|
|
val actions: List<MessageAction>?,
|
2022-01-15 18:40:38 -05:00
|
|
|
val title: String?,
|
|
|
|
|
val message: String,
|
2022-01-17 14:06:59 -05:00
|
|
|
val encoding: String?,
|
2022-01-15 18:40:38 -05:00
|
|
|
val attachment: MessageAttachment?,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@Keep
|
|
|
|
|
data class MessageAttachment(
|
|
|
|
|
val name: String,
|
|
|
|
|
val type: String?,
|
|
|
|
|
val size: Long?,
|
|
|
|
|
val expires: Long?,
|
|
|
|
|
val url: String,
|
|
|
|
|
)
|
2022-01-17 14:06:59 -05:00
|
|
|
|
2022-04-16 20:12:40 -04:00
|
|
|
@Keep
|
|
|
|
|
data class MessageAction(
|
2022-04-17 14:29:29 -04:00
|
|
|
val id: String,
|
2022-04-16 20:12:40 -04:00
|
|
|
val action: String,
|
2022-04-19 09:15:06 -04:00
|
|
|
val label: String, // "view", "broadcast" or "http"
|
2022-04-19 19:20:39 -04:00
|
|
|
val url: String?, // used in "view" and "http" actions
|
|
|
|
|
val method: String?, // used in "http" action, default is POST (!)
|
|
|
|
|
val headers: Map<String,String>?, // used in "http" action
|
|
|
|
|
val body: String?, // used in "http" action
|
|
|
|
|
val intent: String?, // used in "broadcast" action
|
|
|
|
|
val extras: Map<String,String>?, // used in "broadcast" action
|
2022-04-16 20:12:40 -04:00
|
|
|
)
|
|
|
|
|
|
2022-01-17 14:06:59 -05:00
|
|
|
const val MESSAGE_ENCODING_BASE64 = "base64"
|