From 933726904f99fd1b890c99f00c603e4c1ae5ffba Mon Sep 17 00:00:00 2001 From: Christopher Jr Riley Date: Wed, 24 Apr 2024 18:37:31 -0400 Subject: [PATCH 1/5] Update README Added the targets instructions. --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index a76c46268d..d7697a9b54 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,17 @@ dependencies: [ ] ``` +Then under `targets`: +```swift +targets: [ + .target( + // name: ..., + dependencies: [ + .product(name: "ATProtoKit", package: "atprotokit") + ] + ) +] +``` ## Roadmap The Projects page isn't set up yet, so it'll be a while before you can see the progress for this project. However, some of the goals include: From a4d4c945b3711058b504b301b1924ad55f8dfad0 Mon Sep 17 00:00:00 2001 From: Christopher Jr Riley Date: Wed, 24 Apr 2024 18:38:15 -0400 Subject: [PATCH 2/5] Fix formatting in Package.swift --- Package.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Package.swift b/Package.swift index d49485a78b..a816fbce12 100644 --- a/Package.swift +++ b/Package.swift @@ -28,10 +28,11 @@ let package = Package( // Targets can depend on other targets in this package and products from dependencies. .target( name: "ATProtoKit", - dependencies: [ - "SwiftSoup", - .product(name: "Logging", package: "swift-log") - ]) + dependencies: [ + "SwiftSoup", + .product(name: "Logging", package: "swift-log") + ] + ) // .testTarget( // name: "ATProtoKitTests", // dependencies: ["ATProtoKit"]), From 2a6070759582a85a3a7f5bf20a9deb230ecb3fd6 Mon Sep 17 00:00:00 2001 From: Christopher Jr Riley Date: Thu, 25 Apr 2024 16:56:43 -0400 Subject: [PATCH 3/5] Update queryStatuses to latest change --- .../ATProtoAdmin/QueryModerationStatusesAsAdmin.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Sources/ATProtoKit/Networking/ATProtoAdmin/QueryModerationStatusesAsAdmin.swift b/Sources/ATProtoKit/Networking/ATProtoAdmin/QueryModerationStatusesAsAdmin.swift index a6f2363a58..7772078d67 100644 --- a/Sources/ATProtoKit/Networking/ATProtoAdmin/QueryModerationStatusesAsAdmin.swift +++ b/Sources/ATProtoKit/Networking/ATProtoAdmin/QueryModerationStatusesAsAdmin.swift @@ -28,6 +28,7 @@ extension ATProtoAdmin { /// - reviewedAfter: States that the moderator statuses displayed should be after a specified review date. Optional. /// - reviewedBefore: States that the moderator statuses displayed should be before a specified review date. Optional. /// - shouldIncludeMuted: Indicates whether muted subjects should be included in the results. Optional. Defaults to `false`. + /// - isOnlyMuted: Indicates whether only muted subjects and reporters will be returned. /// - reviewState: Specify when fetching subjects in a certain state. Optional. /// - ignoreSubjects: An array of records and repositories to ignore. Optional. /// - lastReviewedBy: Specifies the decentralized identifier (DID) of the moderator whose reviewed statuses are queried. Optional. @@ -41,8 +42,8 @@ extension ATProtoAdmin { /// - cursor: The mark used to indicate the starting point for the next set of results. Optional. /// - Returns: A `Result`, containing either an ``AdminQueryModerationStatusesOutput`` if successful, or an `Error` if not. public func queryStatuses(_ subject: String?, comment: String?, reportedAfter: Date?, reportedBefore: Date?, reviewedAfter: Date?, - reviewedBefore: Date?, shouldIncludeMuted: Bool? = false, reviewState: String?, ignoreSubjects: [String]?, - lastReviewedBy: String?, sortField: AdminQueryModerationStatusesSortField? = .lastReportedAt, + reviewedBefore: Date?, shouldIncludeMuted: Bool? = false, isOnlyMuted: Bool?, reviewState: String?, + ignoreSubjects: [String]?, lastReviewedBy: String?, sortField: AdminQueryModerationStatusesSortField? = .lastReportedAt, sortDirection: AdminQueryModerationStatusesSortDirection? = .descending, isTakenDown: Bool?, isAppealed: Bool?, limit: Int? = 50, tags: [String]?, excludeTags: [String]?, cursor: String?) async throws -> Result { @@ -83,6 +84,11 @@ extension ATProtoAdmin { queryItems.append(("includeMuted", "\(shouldIncludeMuted)")) } + // isOnlyMuted (onlyMuted) + if let isOnlyMuted { + queryItems.append(("onlyMuted", "\(isOnlyMuted)")) + } + // reviewState if let reviewState { queryItems.append(("reviewState", reviewState)) From 1fe0fa0d1132fd28433c9de749b1042b93eafc05 Mon Sep 17 00:00:00 2001 From: Christopher Jr Riley Date: Thu, 25 Apr 2024 17:34:23 -0400 Subject: [PATCH 4/5] Add definitions to OzoneModerationDefs --- .../Moderation/OzoneModerationDefs.swift | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Sources/ATProtoKit/Models/Lexicons/tools.ozone/Moderation/OzoneModerationDefs.swift b/Sources/ATProtoKit/Models/Lexicons/tools.ozone/Moderation/OzoneModerationDefs.swift index 229d50c6bc..57514edcdb 100644 --- a/Sources/ATProtoKit/Models/Lexicons/tools.ozone/Moderation/OzoneModerationDefs.swift +++ b/Sources/ATProtoKit/Models/Lexicons/tools.ozone/Moderation/OzoneModerationDefs.swift @@ -452,6 +452,36 @@ public struct OzoneModerationEventUnmute: Codable { public var comment: String? = nil } +/// A data model definition for a mute reporter event. +/// +/// - Note: According to the AT Protocol specifications: "Mute incoming reports from an account." +/// +/// - SeeAlso: This is based on the [`com.atproto.admin.defs`][github] lexicon. +/// +/// [github]: https://github.com/bluesky-social/atproto/blob/main/lexicons/tools/ozone/moderation/defs.json +public struct OzoneModerationEventMuteReporter: Codable { + /// Indicates how long the account should remain muted (in hours). + /// + /// - Note: According to the AT Protocol specifications: "Indicates how long the account should remain muted." + public let durationInHours: Int + /// Any additional comments about the event. Optional. + public let comment: String? +} + +/// A data model definition for an unmute reporter event. +/// +/// - Note: According to the AT Protocol specifications: "Unmute incoming reports from an account." +/// +/// - SeeAlso: This is based on the [`com.atproto.admin.defs`][github] lexicon. +/// +/// [github]: https://github.com/bluesky-social/atproto/blob/main/lexicons/tools/ozone/moderation/defs.json +public struct OzoneModerationEventUnmuteReporter: Codable { + /// Any additional comments about the event. + /// + /// - Note: According to the AT Protocol specifications: "Describe reasoning behind the reversal." + public let comment: String? +} + /// A data model for a definition of an email event. /// /// - Note: According to the AT Protocol specifications: "Keep a log of outgoing email to a user." From ab25f73f5a741cbe23ba806f90988520d0ec1b6a Mon Sep 17 00:00:00 2001 From: Christopher Jr Riley Date: Thu, 25 Apr 2024 17:51:00 -0400 Subject: [PATCH 5/5] Add cases in AdminEventViewUnion The enum name will be changed in a future commit, along along with moving all of the Union enums into one file. --- .../com.atproto/Admin/AtprotoAdminDefs.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Sources/ATProtoKit/Models/Lexicons/com.atproto/Admin/AtprotoAdminDefs.swift b/Sources/ATProtoKit/Models/Lexicons/com.atproto/Admin/AtprotoAdminDefs.swift index 209c5658b4..2eec6dde67 100644 --- a/Sources/ATProtoKit/Models/Lexicons/com.atproto/Admin/AtprotoAdminDefs.swift +++ b/Sources/ATProtoKit/Models/Lexicons/com.atproto/Admin/AtprotoAdminDefs.swift @@ -320,6 +320,10 @@ public enum AdminEventViewUnion: Codable { case moderationEventMute(OzoneModerationEventMute) /// An unmute event. case moderationEventUnmute(OzoneModerationEventUnmute) + /// A mute reporter event. + case moderationEventMuteReporter(OzoneModerationEventMuteReporter) + /// An unmute reporter event. + case moderationEventUnmuteReporter(OzoneModerationEventUnmuteReporter) /// An email event. case moderationEventEmail(OzoneModerationEventEmail) /// A resolve appeal event. @@ -348,6 +352,10 @@ public enum AdminEventViewUnion: Codable { self = .moderationEventMute(value) } else if let value = try? container.decode(OzoneModerationEventUnmute.self) { self = .moderationEventUnmute(value) + } else if let value = try? container.decode(OzoneModerationEventMuteReporter.self) { + self = .moderationEventMuteReporter(value) + } else if let value = try? container.decode(OzoneModerationEventUnmuteReporter.self) { + self = .moderationEventUnmuteReporter(value) } else if let value = try? container.decode(OzoneModerationEventEmail.self) { self = .moderationEventEmail(value) } else if let value = try? container.decode(OzoneModerationEventResolveAppeal.self) { @@ -382,6 +390,10 @@ public enum AdminEventViewUnion: Codable { try container.encode(moderationEventMute) case .moderationEventUnmute(let moderationEventUnmute): try container.encode(moderationEventUnmute) + case .moderationEventMuteReporter(let moderationEventMuteReporter): + try container.encode(moderationEventMuteReporter) + case .moderationEventUnmuteReporter(let moderationEventUnmuteReporter): + try container.encode(moderationEventUnmuteReporter) case .moderationEventEmail(let moderationEventEmail): try container.encode(moderationEventEmail) case .moderationEventResolveAppeal(let moderationEventResolveAppeal):