diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ApproveRegistrationApplication.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ApproveRegistrationApplication.swift new file mode 100644 index 0000000..d50e205 --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ApproveRegistrationApplication.swift @@ -0,0 +1,32 @@ +import Foundation + +public struct ApproveRegistrationApplicationRequest: APIRequest { + public typealias Response = RegistrationApplicationResponse + + public static let httpMethod: HTTPMethod = .put + public static let path: String = "/admin/registration_application/approve" + + public let id: Int? + public let approve: Bool? + public let deny_reason: String? + + public init( + id: Int? = nil, + approve: Bool? = nil, + deny_reason: String? = nil + ) { + self.id = id + self.approve = approve + self.deny_reason = deny_reason + } +} + +public struct RegistrationApplicationResponse: APIResponse { + public let registration_application: RegistrationApplicationView? + + public init( + registration_application: RegistrationApplicationView? = nil + ) { + self.registration_application = registration_application + } +} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreatePrivateMessageReport.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreatePrivateMessageReport.swift new file mode 100644 index 0000000..3eddfbb --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreatePrivateMessageReport.swift @@ -0,0 +1,29 @@ +import Foundation + +public struct CreatePrivateMessageReportRequest: APIRequest { + public typealias Response = PrivateMessageReportResponse + + public static let httpMethod: HTTPMethod = .post + public static let path: String = "/private_message/report" + + public let private_message_id: PrivateMessageId? + public let reason: String? + + public init( + private_message_id: PrivateMessageId? = nil, + reason: String? = nil + ) { + self.private_message_id = private_message_id + self.reason = reason + } +} + +public struct PrivateMessageReportResponse: APIResponse { + public let private_message_report_view: PrivateMessageReportView? + + public init( + private_message_report_view: PrivateMessageReportView? = nil + ) { + self.private_message_report_view = private_message_report_view + } +} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ListPrivateMessageReports.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ListPrivateMessageReports.swift new file mode 100644 index 0000000..bce1d4c --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ListPrivateMessageReports.swift @@ -0,0 +1,32 @@ +import Foundation + +public struct ListPrivateMessageReportsRequest: APIRequest { + public typealias Response = ListPrivateMessageReportsResponse + + public static let httpMethod: HTTPMethod = .get + public static let path: String = "/private_message/report/list" + + public let page: Int? + public let limit: Int? + public let unresolved_only: Bool? + + public init( + page: Int? = nil, + limit: Int? = nil, + unresolved_only: Bool? = nil + ) { + self.page = page + self.limit = limit + self.unresolved_only = unresolved_only + } +} + +public struct ListPrivateMessageReportsResponse: APIResponse { + public let private_message_reports: [PrivateMessageReportView]? + + public init( + private_message_reports: [PrivateMessageReportView]? = nil + ) { + self.private_message_reports = private_message_reports + } +} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ListRegistrationApplications.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ListRegistrationApplications.swift new file mode 100644 index 0000000..c92118b --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ListRegistrationApplications.swift @@ -0,0 +1,32 @@ +import Foundation + +public struct ListRegistrationApplicationsRequest: APIRequest { + public typealias Response = ListRegistrationApplicationsResponse + + public static let httpMethod: HTTPMethod = .get + public static let path: String = "/admin/registration_application/list" + + public let unread_only: Bool? + public let page: Int? + public let limit: Int? + + public init( + unread_only: Bool? = nil, + page: Int? = nil, + limit: Int? = nil + ) { + self.unread_only = unread_only + self.page = page + self.limit = limit + } +} + +public struct ListRegistrationApplicationsResponse: APIResponse { + public let registration_applications: [RegistrationApplicationView]? + + public init( + registration_applications: [RegistrationApplicationView]? = nil + ) { + self.registration_applications = registration_applications + } +} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ResolvePrivateMessageReport.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ResolvePrivateMessageReport.swift similarity index 50% rename from Sources/Lemmy-Swift-Client/Lemmy API/Structs/ResolvePrivateMessageReport.swift rename to Sources/Lemmy-Swift-Client/Lemmy API/Requests/ResolvePrivateMessageReport.swift index a993b9a..51e7181 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ResolvePrivateMessageReport.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ResolvePrivateMessageReport.swift @@ -1,6 +1,11 @@ import Foundation -public struct ResolvePrivateMessageReport: Codable, Hashable { +public struct ResolvePrivateMessageReportRequest: APIRequest { + public typealias Response = PrivateMessageReportResponse + + public static let httpMethod: HTTPMethod = .put + public static let path: String = "/private_message/report/resolve" + public let report_id: PrivateMessageReportId? public let resolved: Bool? diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ApproveRegistrationApplication.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ApproveRegistrationApplication.swift deleted file mode 100644 index 1424ee7..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ApproveRegistrationApplication.swift +++ /dev/null @@ -1,17 +0,0 @@ -import Foundation - -public struct ApproveRegistrationApplication: Codable, Identifiable, Hashable { - public let id: Int? - public let approve: Bool? - public let deny_reason: String? - - public init( - id: Int? = nil, - approve: Bool? = nil, - deny_reason: String? = nil - ) { - self.id = id - self.approve = approve - self.deny_reason = deny_reason - } -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CreatePrivateMessageReport.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CreatePrivateMessageReport.swift deleted file mode 100644 index e7746bf..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CreatePrivateMessageReport.swift +++ /dev/null @@ -1,14 +0,0 @@ -import Foundation - -public struct CreatePrivateMessageReport: Codable, Hashable { - public let private_message_id: PrivateMessageId? - public let reason: String? - - public init( - private_message_id: PrivateMessageId? = nil, - reason: String? = nil - ) { - self.private_message_id = private_message_id - self.reason = reason - } -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListPrivateMessageReports.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListPrivateMessageReports.swift deleted file mode 100644 index d171737..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListPrivateMessageReports.swift +++ /dev/null @@ -1,17 +0,0 @@ -import Foundation - -public struct ListPrivateMessageReports: Codable, Hashable { - public let page: Int? - public let limit: Int? - public let unresolved_only: Bool? - - public init( - page: Int? = nil, - limit: Int? = nil, - unresolved_only: Bool? = nil - ) { - self.page = page - self.limit = limit - self.unresolved_only = unresolved_only - } -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListPrivateMessageReportsResponse.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListPrivateMessageReportsResponse.swift deleted file mode 100644 index 119fefe..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListPrivateMessageReportsResponse.swift +++ /dev/null @@ -1,11 +0,0 @@ -import Foundation - -public struct ListPrivateMessageReportsResponse: Codable, Hashable { - public let private_message_reports: [PrivateMessageReportView]? - - public init( - private_message_reports: [PrivateMessageReportView]? = nil - ) { - self.private_message_reports = private_message_reports - } -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListRegistrationApplications.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListRegistrationApplications.swift deleted file mode 100644 index 471aa8e..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListRegistrationApplications.swift +++ /dev/null @@ -1,17 +0,0 @@ -import Foundation - -public struct ListRegistrationApplications: Codable, Hashable { - public let unread_only: Bool? - public let page: Int? - public let limit: Int? - - public init( - unread_only: Bool? = nil, - page: Int? = nil, - limit: Int? = nil - ) { - self.unread_only = unread_only - self.page = page - self.limit = limit - } -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListRegistrationApplicationsResponse.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListRegistrationApplicationsResponse.swift deleted file mode 100644 index 0aba3d6..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListRegistrationApplicationsResponse.swift +++ /dev/null @@ -1,11 +0,0 @@ -import Foundation - -public struct ListRegistrationApplicationsResponse: Codable, Hashable { - public let registration_applications: [RegistrationApplicationView]? - - public init( - registration_applications: [RegistrationApplicationView]? = nil - ) { - self.registration_applications = registration_applications - } -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessageReportResponse.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessageReportResponse.swift deleted file mode 100644 index 7f680e4..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessageReportResponse.swift +++ /dev/null @@ -1,11 +0,0 @@ -import Foundation - -public struct PrivateMessageReportResponse: Codable, Hashable { - public let private_message_report_view: PrivateMessageReportView? - - public init( - private_message_report_view: PrivateMessageReportView? = nil - ) { - self.private_message_report_view = private_message_report_view - } -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/RegistrationApplicationResponse.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/RegistrationApplicationResponse.swift deleted file mode 100644 index 3940575..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/RegistrationApplicationResponse.swift +++ /dev/null @@ -1,11 +0,0 @@ -import Foundation - -public struct RegistrationApplicationResponse: Codable, Hashable { - public let registration_application: RegistrationApplicationView? - - public init( - registration_application: RegistrationApplicationView? = nil - ) { - self.registration_application = registration_application - } -}