44 lines
1.0 KiB
Swift
44 lines
1.0 KiB
Swift
|
//
|
||
|
// EditedReport.swift
|
||
|
// Tusker
|
||
|
//
|
||
|
// Created by Shadowfacts on 1/13/23.
|
||
|
// Copyright © 2023 Shadowfacts. All rights reserved.
|
||
|
//
|
||
|
|
||
|
import Foundation
|
||
|
import Pachyderm
|
||
|
|
||
|
class EditedReport: ObservableObject {
|
||
|
let accountID: String
|
||
|
@Published var statusIDs = [String]()
|
||
|
@Published var comment = ""
|
||
|
@Published var forward = false
|
||
|
@Published var reason: Reason = .spam
|
||
|
|
||
|
init(accountID: String) {
|
||
|
self.accountID = accountID
|
||
|
}
|
||
|
|
||
|
func makeRequest() -> Request<Report>? {
|
||
|
let category: String
|
||
|
let ruleIDs: [String]
|
||
|
switch reason {
|
||
|
case .spam:
|
||
|
category = "spam"
|
||
|
ruleIDs = []
|
||
|
case .rules(let ids):
|
||
|
category = "violation"
|
||
|
ruleIDs = ids
|
||
|
}
|
||
|
return Client.report(account: accountID, statuses: statusIDs, comment: comment, forward: forward, category: category, ruleIDs: ruleIDs)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
extension EditedReport {
|
||
|
enum Reason {
|
||
|
case spam
|
||
|
case rules([String])
|
||
|
}
|
||
|
}
|