2021-04-27 10:26:59 +02:00
|
|
|
//
|
|
|
|
// MastodonNotification.swift
|
|
|
|
// NotificationService
|
|
|
|
//
|
|
|
|
// Created by MainasuK Cirno on 2021-4-26.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
|
|
|
struct MastodonPushNotification: Codable {
|
|
|
|
|
2021-10-11 13:19:27 +02:00
|
|
|
let _accessToken: String
|
2021-04-27 10:26:59 +02:00
|
|
|
var accessToken: String {
|
|
|
|
return String.normalize(base64String: _accessToken)
|
|
|
|
}
|
|
|
|
|
|
|
|
let notificationID: Int
|
|
|
|
let notificationType: String
|
|
|
|
|
|
|
|
let preferredLocale: String?
|
|
|
|
let icon: String?
|
|
|
|
let title: String
|
|
|
|
let body: String
|
|
|
|
|
|
|
|
enum CodingKeys: String, CodingKey {
|
|
|
|
case _accessToken = "access_token"
|
|
|
|
case notificationID = "notification_id"
|
|
|
|
case notificationType = "notification_type"
|
|
|
|
case preferredLocale = "preferred_locale"
|
|
|
|
case icon
|
|
|
|
case title
|
|
|
|
case body
|
|
|
|
}
|
|
|
|
|
2021-10-11 13:19:27 +02:00
|
|
|
public init(
|
|
|
|
_accessToken: String,
|
|
|
|
notificationID: Int,
|
|
|
|
notificationType: String,
|
|
|
|
preferredLocale: String?,
|
|
|
|
icon: String?,
|
|
|
|
title: String,
|
|
|
|
body: String
|
|
|
|
) {
|
|
|
|
self._accessToken = _accessToken
|
|
|
|
self.notificationID = notificationID
|
|
|
|
self.notificationType = notificationType
|
|
|
|
self.preferredLocale = preferredLocale
|
|
|
|
self.icon = icon
|
|
|
|
self.title = title
|
|
|
|
self.body = body
|
|
|
|
}
|
|
|
|
|
2021-04-27 10:26:59 +02:00
|
|
|
}
|