75 lines
2.3 KiB
Swift
75 lines
2.3 KiB
Swift
//
|
|
// PrivadoNotification.swift
|
|
// PrivadoVPN
|
|
//
|
|
// Created by Juraldinio on 8/25/20.
|
|
// Copyright © 2020 Privado LLC. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
struct PrivadoNotification: Decodable {
|
|
struct Payload: Decodable {
|
|
/// for situations when we need to modify the looks of the app (CTA, colors, theme - to be expanded later)
|
|
struct Styling: Decodable {
|
|
let callToActionText: String
|
|
let textColor: String
|
|
let backgroundColor: String
|
|
|
|
enum CodingKeys: String, CodingKey {
|
|
case callToActionText = "cta_text"
|
|
case textColor = "cta_text_color"
|
|
case backgroundColor = "cta_text_bgcolor"
|
|
}
|
|
}
|
|
/// mandatory, body of the news, can be large string, follows MarkDown format
|
|
let body: String
|
|
/// email is optional
|
|
let email: String?
|
|
/// optional, lists all actions that app needs to perform
|
|
let actions: [String]?
|
|
/// optional, lists header/subject for the message
|
|
let subject: String?
|
|
let customer: Customer?
|
|
/// number, from 0 lowest to 10+ highest
|
|
let priority: Int
|
|
/// Username is primary key identifying the customer, doesn't change, string, mandatory.
|
|
let username: String
|
|
/// unix-timestamp for message creation date&time
|
|
let created: String
|
|
/// unix-timestamp showing when the message should expire in the app (sticky message), can be empty
|
|
let expires: String
|
|
let sentDate: String
|
|
let styling: Styling?
|
|
/// optional, can be used by apps for duplicate tracking logics
|
|
let slug: String?
|
|
let url: String?
|
|
let skip: Bool?
|
|
|
|
enum CodingKeys: String, CodingKey {
|
|
case body
|
|
case email
|
|
case actions
|
|
case subject
|
|
case customer
|
|
case priority
|
|
case username
|
|
case created = "created_at"
|
|
case expires = "expires_at"
|
|
case sentDate = "sent_at"
|
|
case styling
|
|
case slug
|
|
case url
|
|
case skip = "skip_iap"
|
|
}
|
|
}
|
|
|
|
let channel: String
|
|
let payload: Payload
|
|
|
|
enum CodingKeys: String, CodingKey {
|
|
case channel
|
|
case payload = "data"
|
|
}
|
|
}
|