mirror of
https://github.com/metabolist/metatext.git
synced 2024-06-02 06:01:12 +00:00
32 lines
777 B
Swift
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
|
|
}
|
|
}
|
|
}
|