mirror of
git://jb55.com/damus
synced 2024-09-29 16:30:44 +00:00
filter: add reposts query filter helper
Add a filter helper to easily query quote repost queries. Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
parent
0043f0059d
commit
6111e244de
@ -18,6 +18,7 @@ struct NostrFilter: Codable, Equatable {
|
||||
var authors: [Pubkey]?
|
||||
var hashtag: [String]?
|
||||
var parameter: [String]?
|
||||
var quotes: [NoteId]?
|
||||
|
||||
private enum CodingKeys : String, CodingKey {
|
||||
case ids
|
||||
@ -26,13 +27,14 @@ struct NostrFilter: Codable, Equatable {
|
||||
case pubkeys = "#p"
|
||||
case hashtag = "#t"
|
||||
case parameter = "#d"
|
||||
case quotes = "#q"
|
||||
case since
|
||||
case until
|
||||
case authors
|
||||
case limit
|
||||
}
|
||||
|
||||
init(ids: [NoteId]? = nil, kinds: [NostrKind]? = nil, referenced_ids: [NoteId]? = nil, pubkeys: [Pubkey]? = nil, since: UInt32? = nil, until: UInt32? = nil, limit: UInt32? = nil, authors: [Pubkey]? = nil, hashtag: [String]? = nil) {
|
||||
init(ids: [NoteId]? = nil, kinds: [NostrKind]? = nil, referenced_ids: [NoteId]? = nil, pubkeys: [Pubkey]? = nil, since: UInt32? = nil, until: UInt32? = nil, limit: UInt32? = nil, authors: [Pubkey]? = nil, hashtag: [String]? = nil, quotes: [NoteId]? = nil) {
|
||||
self.ids = ids
|
||||
self.kinds = kinds
|
||||
self.referenced_ids = referenced_ids
|
||||
@ -42,6 +44,7 @@ struct NostrFilter: Codable, Equatable {
|
||||
self.limit = limit
|
||||
self.authors = authors
|
||||
self.hashtag = hashtag
|
||||
self.quotes = quotes
|
||||
}
|
||||
|
||||
public static func copy(from: NostrFilter) -> NostrFilter {
|
||||
|
@ -1,26 +0,0 @@
|
||||
//
|
||||
// BoostedNotify.swift
|
||||
// damus
|
||||
//
|
||||
// Created by William Casarin on 2023-07-30.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
struct RepostedNotify: Notify {
|
||||
typealias Payload = Counted
|
||||
var payload: Payload
|
||||
}
|
||||
|
||||
extension NotifyHandler {
|
||||
static var reposted: NotifyHandler<RepostedNotify> {
|
||||
.init()
|
||||
}
|
||||
}
|
||||
|
||||
extension Notifications {
|
||||
static func reposted(_ counts: Counted) -> Notifications<RepostedNotify> {
|
||||
.init(.init(payload: counts))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user