Skip to content

Commit

Permalink
Merge pull request #59 from Dimillian/fix-listNotifications
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterJ93 authored Nov 26, 2024
2 parents 0892375 + da120b5 commit 16d1c9d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extension ATProtoKit {
withLimitOf limit: Int? = 50,
priority: Bool?,
cursor: String? = nil,
seenAt: Date = Date()
seenAt: Date? = nil
) async throws -> AppBskyLexicon.Notification.ListNotificationsOutput {
guard session != nil,
let accessToken = session?.accessToken else {
Expand All @@ -60,11 +60,10 @@ extension ATProtoKit {
queryItems.append(("cursor", cursor))
}

guard let formattedSeenAt = CustomDateFormatter.shared.string(from: seenAt) else {
throw ATRequestPrepareError.invalidFormat
if let seenAt, let formattedSeenAt = CustomDateFormatter.shared.string(from: seenAt) {
queryItems.append(("seenAt", formattedSeenAt))
}

queryItems.append(("seenAt", formattedSeenAt))

let queryURL: URL

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ extension AppBskyLexicon.Notification {
public let notificationCID: String

/// The author of the record contained in the notification.
public let notificationAuthor: String
public let notificationAuthor: AppBskyLexicon.Actor.ProfileViewBasicDefinition

/// The kind of notification received.
///
Expand All @@ -98,7 +98,7 @@ extension AppBskyLexicon.Notification {
/// The date and time the notification was last indexed.
public let indexedAt: Date

public init(notificationURI: String, notificationCID: String, notificationAuthor: String, notificationReason: Reason, reasonSubjectURI: String?,
public init(notificationURI: String, notificationCID: String, notificationAuthor: AppBskyLexicon.Actor.ProfileViewBasicDefinition, notificationReason: Reason, reasonSubjectURI: String?,
record: UnknownType, isRead: Bool, indexedAt: Date, labels: [ComAtprotoLexicon.Label.LabelDefinition]?) {
self.notificationURI = notificationURI
self.notificationCID = notificationCID
Expand All @@ -116,7 +116,7 @@ extension AppBskyLexicon.Notification {

self.notificationURI = try container.decode(String.self, forKey: .notificationURI)
self.notificationCID = try container.decode(String.self, forKey: .notificationCID)
self.notificationAuthor = try container.decode(String.self, forKey: .notificationAuthor)
self.notificationAuthor = try container.decode(AppBskyLexicon.Actor.ProfileViewBasicDefinition.self, forKey: .notificationAuthor)
self.notificationReason = try container.decode(AppBskyLexicon.Notification.Notification.Reason.self, forKey: .notificationReason)
self.reasonSubjectURI = try container.decodeIfPresent(String.self, forKey: .reasonSubjectURI)
self.record = try container.decode(UnknownType.self, forKey: .record)
Expand Down

0 comments on commit 16d1c9d

Please sign in to comment.