metatext/MastodonAPI/Sources/MastodonAPI/Endpoints/NotificationsEndpoint.swift
Justin Mazzocchi 195f2d6a29
Mentions tab
2021-01-25 18:10:24 -08:00

32 lines
777 B
Swift

// Copyright © 2020 Metabolist. All rights reserved.
import Foundation
import HTTP
import Mastodon
public enum NotificationsEndpoint {
case notifications(excludeTypes: Set<MastodonNotification.NotificationType>)
}
extension NotificationsEndpoint: Endpoint {
public typealias ResultType = [MastodonNotification]
public var pathComponentsInContext: [String] {
["notifications"]
}
public var queryParameters: [URLQueryItem] {
switch self {
case let .notifications(excludeTypes):
return Array(excludeTypes).map { URLQueryItem(name: "exclude_types[]", value: $0.rawValue) }
}
}
public var method: HTTPMethod {
switch self {
case .notifications:
return .get
}
}
}