mirror of
git://jb55.com/damus
synced 2024-09-30 00:40:45 +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 authors: [Pubkey]?
|
||||||
var hashtag: [String]?
|
var hashtag: [String]?
|
||||||
var parameter: [String]?
|
var parameter: [String]?
|
||||||
|
var quotes: [NoteId]?
|
||||||
|
|
||||||
private enum CodingKeys : String, CodingKey {
|
private enum CodingKeys : String, CodingKey {
|
||||||
case ids
|
case ids
|
||||||
@ -26,13 +27,14 @@ struct NostrFilter: Codable, Equatable {
|
|||||||
case pubkeys = "#p"
|
case pubkeys = "#p"
|
||||||
case hashtag = "#t"
|
case hashtag = "#t"
|
||||||
case parameter = "#d"
|
case parameter = "#d"
|
||||||
|
case quotes = "#q"
|
||||||
case since
|
case since
|
||||||
case until
|
case until
|
||||||
case authors
|
case authors
|
||||||
case limit
|
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.ids = ids
|
||||||
self.kinds = kinds
|
self.kinds = kinds
|
||||||
self.referenced_ids = referenced_ids
|
self.referenced_ids = referenced_ids
|
||||||
@ -42,6 +44,7 @@ struct NostrFilter: Codable, Equatable {
|
|||||||
self.limit = limit
|
self.limit = limit
|
||||||
self.authors = authors
|
self.authors = authors
|
||||||
self.hashtag = hashtag
|
self.hashtag = hashtag
|
||||||
|
self.quotes = quotes
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func copy(from: NostrFilter) -> NostrFilter {
|
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