2018-09-11 14:52:21 +00:00
|
|
|
//
|
|
|
|
// Notification.swift
|
|
|
|
// Pachyderm
|
|
|
|
//
|
|
|
|
// Created by Shadowfacts on 9/9/18.
|
|
|
|
// Copyright © 2018 Shadowfacts. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
2018-09-17 23:22:37 +00:00
|
|
|
public class Notification: Decodable {
|
2018-09-11 14:52:21 +00:00
|
|
|
public let id: String
|
|
|
|
public let kind: Kind
|
|
|
|
public let createdAt: Date
|
|
|
|
public let account: Account
|
|
|
|
public let status: Status?
|
|
|
|
|
2018-09-17 23:22:37 +00:00
|
|
|
public static func dismiss(_ notification: Notification) -> Request<Empty> {
|
|
|
|
return Request<Empty>(method: .post, path: "/api/v1/notifications/dismiss", body: .parameters([
|
|
|
|
"id" => notification.id
|
2018-09-11 14:52:21 +00:00
|
|
|
]))
|
|
|
|
}
|
|
|
|
|
|
|
|
private enum CodingKeys: String, CodingKey {
|
|
|
|
case id
|
|
|
|
case kind = "type"
|
|
|
|
case createdAt = "created_at"
|
|
|
|
case account
|
|
|
|
case status
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
extension Notification {
|
2019-09-14 16:04:06 +00:00
|
|
|
public enum Kind: String, Decodable, CaseIterable {
|
2018-09-11 14:52:21 +00:00
|
|
|
case mention
|
|
|
|
case reblog
|
|
|
|
case favourite
|
|
|
|
case follow
|
|
|
|
}
|
|
|
|
}
|
2019-09-05 18:33:10 +00:00
|
|
|
|
|
|
|
extension Notification: Identifiable {}
|