diff --git a/Package.swift b/Package.swift index 5396185..467e42b 100644 --- a/Package.swift +++ b/Package.swift @@ -6,11 +6,11 @@ import PackageDescription let package = Package( name: "Lemmy-Swift-Client", platforms: [ - .iOS(.v16), + .iOS(.v13), .macOS(.v13), - .tvOS(.v16), + .tvOS(.v13), .watchOS(.v9), - .macCatalyst(.v16) + .macCatalyst(.v13) ], products: [ // Products define the executables and libraries a package produces, making them visible to other packages. diff --git a/README.md b/README.md index a5c29e3..841f5fa 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A Swift client for [Lemmy](https://join-lemmy.org). ## Features - Fully Swift type safe -- `async`/`await` compatible +- `async`/`await` and `Combine` compatible - Supports [all Lemmy API endpoints](https://join-lemmy.org/api/classes/LemmyHttp.html) - Uses Codable for easy JSON serialization/deserialization diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Enums/CommentSortType.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Enums/CommentSortType.swift index 2bd4823..52ba962 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Enums/CommentSortType.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Enums/CommentSortType.swift @@ -5,6 +5,7 @@ public enum CommentSortType: String, Codable, CustomStringConvertible, CaseItera case top = "Top" case new = "New" case old = "Old" + case controversial = "Controversial" public var description: String { return rawValue diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Enums/LemmyErrorType.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Enums/LemmyErrorType.swift new file mode 100644 index 0000000..3bef73d --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Enums/LemmyErrorType.swift @@ -0,0 +1,159 @@ +import Foundation + +public enum LemmyErrorType: String, Codable, CustomStringConvertible, CaseIterable { + case report_reason_required = "report_reason_required" + case report_too_long = "report_too_long" + case not_a_moderator = "not_a_moderator" + case not_an_admin = "not_an_admin" + case cant_block_yourself = "cant_block_yourself" + case cant_block_admin = "cant_block_admin" + case couldnt_update_user = "couldnt_update_user" + case passwords_do_not_match = "passwords_do_not_match" + case email_not_verified = "email_not_verified" + case email_required = "email_required" + case couldnt_update_comment = "couldnt_update_comment" + case couldnt_update_private_message = "couldnt_update_private_message" + case cannot_leave_admin = "cannot_leave_admin" + case no_lines_in_html = "no_lines_in_html" + case site_metadata_page_is_not_doctype_html = "site_metadata_page_is_not_doctype_html" + case pictrs_response_error = "pictrs_response_error" + case pictrs_purge_response_error = "pictrs_purge_response_error" + case pictrs_caching_disabled = "pictrs_caching_disabled" + case image_url_missing_path_segments = "image_url_missing_path_segments" + case image_url_missing_last_path_segment = "image_url_missing_last_path_segment" + case pictrs_api_key_not_provided = "pictrs_api_key_not_provided" + case no_content_type_header = "no_content_type_header" + case not_an_image_type = "not_an_image_type" + case not_a_mod_or_admin = "not_a_mod_or_admin" + case no_admins = "no_admins" + case not_top_admin = "not_top_admin" + case not_top_mod = "not_top_mod" + case not_logged_in = "not_logged_in" + case site_ban = "site_ban" + case deleted = "deleted" + case banned_from_community = "banned_from_community" + case couldnt_find_community = "couldnt_find_community" + case couldnt_find_person = "couldnt_find_person" + case person_is_blocked = "person_is_blocked" + case community_is_blocked = "community_is_blocked" + case instance_is_blocked = "instance_is_blocked" + case downvotes_are_disabled = "downvotes_are_disabled" + case instance_is_private = "instance_is_private" + case invalid_password = "invalid_password" + case site_description_length_overflow = "site_description_length_overflow" + case honeypot_failed = "honeypot_failed" + case registration_application_is_pending = "registration_application_is_pending" + case cant_enable_private_instance_and_federation_together = "cant_enable_private_instance_and_federation_together" + case locked = "locked" + case couldnt_create_comment = "couldnt_create_comment" + case max_comment_depth_reached = "max_comment_depth_reached" + case no_comment_edit_allowed = "no_comment_edit_allowed" + case only_admins_can_create_communities = "only_admins_can_create_communities" + case community_already_exists = "community_already_exists" + case language_not_allowed = "language_not_allowed" + case only_mods_can_post_in_community = "only_mods_can_post_in_community" + case couldnt_update_post = "couldnt_update_post" + case no_post_edit_allowed = "no_post_edit_allowed" + case couldnt_find_post = "couldnt_find_post" + case edit_private_message_not_allowed = "edit_private_message_not_allowed" + case site_already_exists = "site_already_exists" + case application_question_required = "application_question_required" + case invalid_default_post_listing_type = "invalid_default_post_listing_type" + case registration_closed = "registration_closed" + case registration_application_answer_required = "registration_application_answer_required" + case email_already_exists = "email_already_exists" + case federation_forbidden_by_strict_allow_list = "federation_forbidden_by_strict_allow_list" + case person_is_banned_from_community = "person_is_banned_from_community" + case object_is_not_public = "object_is_not_public" + case invalid_community = "invalid_community" + case cannot_create_post_or_comment_in_deleted_or_removed_community = "cannot_create_post_or_comment_in_deleted_or_removed_community" + case cannot_receive_page = "cannot_receive_page" + case new_post_cannot_be_locked = "new_post_cannot_be_locked" + case only_local_admin_can_remove_community = "only_local_admin_can_remove_community" + case only_local_admin_can_restore_community = "only_local_admin_can_restore_community" + case no_id_given = "no_id_given" + case incorrect_login = "incorrect_login" + case invalid_query = "invalid_query" + case object_not_local = "object_not_local" + case post_is_locked = "post_is_locked" + case person_is_banned_from_site = "person_is_banned_from_site" + case invalid_vote_value = "invalid_vote_value" + case page_does_not_specify_creator = "page_does_not_specify_creator" + case page_does_not_specify_group = "page_does_not_specify_group" + case no_community_found_in_cc = "no_community_found_in_cc" + case no_email_setup = "no_email_setup" + case email_smtp_server_needs_a_port = "email_smtp_server_needs_a_port" + case missing_an_email = "missing_an_email" + case rate_limit_error = "rate_limit_error" + case invalid_name = "invalid_name" + case invalid_display_name = "invalid_display_name" + case invalid_matrix_id = "invalid_matrix_id" + case invalid_post_title = "invalid_post_title" + case invalid_body_field = "invalid_body_field" + case bio_length_overflow = "bio_length_overflow" + case missing_totp_token = "missing_totp_token" + case missing_totp_secret = "missing_totp_secret" + case incorrect_totp_token = "incorrect_totp_token" + case couldnt_parse_totp_secret = "couldnt_parse_totp_secret" + case couldnt_generate_totp = "couldnt_generate_totp" + case totp_already_enabled = "totp_already_enabled" + case couldnt_like_comment = "couldnt_like_comment" + case couldnt_save_comment = "couldnt_save_comment" + case couldnt_create_report = "couldnt_create_report" + case couldnt_resolve_report = "couldnt_resolve_report" + case community_moderator_already_exists = "community_moderator_already_exists" + case community_user_already_banned = "community_user_already_banned" + case community_block_already_exists = "community_block_already_exists" + case community_follower_already_exists = "community_follower_already_exists" + case couldnt_update_community_hidden_status = "couldnt_update_community_hidden_status" + case person_block_already_exists = "person_block_already_exists" + case user_already_exists = "user_already_exists" + case token_not_found = "token_not_found" + case couldnt_like_post = "couldnt_like_post" + case couldnt_save_post = "couldnt_save_post" + case couldnt_mark_post_as_read = "couldnt_mark_post_as_read" + case couldnt_update_community = "couldnt_update_community" + case couldnt_update_replies = "couldnt_update_replies" + case couldnt_update_person_mentions = "couldnt_update_person_mentions" + case post_title_too_long = "post_title_too_long" + case couldnt_create_post = "couldnt_create_post" + case couldnt_create_private_message = "couldnt_create_private_message" + case couldnt_update_private = "couldnt_update_private" + case system_err_login = "system_err_login" + case couldnt_set_all_registrations_accepted = "couldnt_set_all_registrations_accepted" + case couldnt_set_all_email_verified = "couldnt_set_all_email_verified" + case banned = "banned" + case couldnt_get_comments = "couldnt_get_comments" + case couldnt_get_posts = "couldnt_get_posts" + case invalid_url = "invalid_url" + case email_send_failed = "email_send_failed" + case slurs = "slurs" + case couldnt_find_object = "couldnt_find_object" + case registration_denied = "registration_denied" + case federation_disabled = "federation_disabled" + case domain_blocked = "domain_blocked" + case domain_not_in_allow_list = "domain_not_in_allow_list" + case federation_disabled_by_strict_allow_list = "federation_disabled_by_strict_allow_list" + case site_name_required = "site_name_required" + case site_name_length_overflow = "site_name_length_overflow" + case permissive_regex = "permissive_regex" + case invalid_regex = "invalid_regex" + case captcha_incorrect = "captcha_incorrect" + case password_reset_limit_reached = "password_reset_limit_reached" + case couldnt_create_audio_captcha = "couldnt_create_audio_captcha" + case invalid_url_scheme = "invalid_url_scheme" + case couldnt_send_webmention = "couldnt_send_webmention" + case contradicting_filters = "contradicting_filters" + case instance_block_already_exists = "instance_block_already_exists" + case too_many_items = "too_many_items" + case community_has_no_followers = "community_has_no_followers" + case ban_expiration_in_past = "ban_expiration_in_past" + case invalid_unix_time = "invalid_unix_time" + case invalid_bot_action = "invalid_bot_action" + case cant_block_local_instance = "cant_block_local_instance" + case unknown = "unknown" + + public var description: String { + return rawValue + } +} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Enums/ListingType.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Enums/ListingType.swift index 0106644..6c94edc 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Enums/ListingType.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Enums/ListingType.swift @@ -4,6 +4,7 @@ public enum ListingType: String, Codable, CustomStringConvertible, CaseIterable case all = "All" case local = "Local" case subscribed = "Subscribed" + case moderatorView = "ModeratorView" public var description: String { return rawValue diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Enums/PostListingMode.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Enums/PostListingMode.swift new file mode 100644 index 0000000..0aa9d50 --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Enums/PostListingMode.swift @@ -0,0 +1,11 @@ +import Foundation + +public enum PostListingMode: String, Codable, CustomStringConvertible, CaseIterable { + case list = "List" + case card = "Card" + case smallCard = "SmallCard" + + public var description: String { + return rawValue + } +} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Enums/SortType.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Enums/SortType.swift index 68e99af..99a861f 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Enums/SortType.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Enums/SortType.swift @@ -18,6 +18,8 @@ public enum SortType: String, Codable, CustomStringConvertible, CaseIterable { case topThreeMonths = "TopThreeMonths" case topSixMonths = "TopSixMonths" case topNineMonths = "TopNineMonths" + case controversial = "Controversial" + case scaled = "Scaled" public var description: String { return rawValue diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/AddAdmin.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/AddAdmin.swift index 6c80ef9..ad79c68 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/AddAdmin.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/AddAdmin.swift @@ -6,18 +6,15 @@ public struct AddAdminRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/admin/add" - public let person_id: PersonId + public let personId: PersonId public let added: Bool - public let auth: String public init( - person_id: PersonId, - added: Bool, - auth: String + personId: PersonId, + added: Bool ) { - self.person_id = person_id + self.personId = personId self.added = added - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/AddModToCommunity.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/AddModToCommunity.swift index e287dfd..0f5436a 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/AddModToCommunity.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/AddModToCommunity.swift @@ -6,21 +6,18 @@ public struct AddModToCommunityRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/community/mod" - public let community_id: CommunityId - public let person_id: PersonId + public let communityId: CommunityId + public let personId: PersonId public let added: Bool - public let auth: String public init( - community_id: CommunityId, - person_id: PersonId, - added: Bool, - auth: String + communityId: CommunityId, + personId: PersonId, + added: Bool ) { - self.community_id = community_id - self.person_id = person_id + self.communityId = communityId + self.personId = personId self.added = added - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/BanFromCommunity.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/BanFromCommunity.swift index 03555c5..8a6921d 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/BanFromCommunity.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/BanFromCommunity.swift @@ -6,42 +6,39 @@ public struct BanFromCommunityRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/community/ban_user" - public let community_id: CommunityId - public let person_id: PersonId + public let communityId: CommunityId + public let personId: PersonId public let ban: Bool - public let remove_data: Bool? + public let removeData: Bool? public let reason: String? public let expires: Int? - public let auth: String public init( - community_id: CommunityId, - person_id: PersonId, + communityId: CommunityId, + personId: PersonId, ban: Bool, - remove_data: Bool? = nil, + removeData: Bool? = nil, reason: String? = nil, - expires: Int? = nil, - auth: String + expires: Int? = nil ) { - self.community_id = community_id - self.person_id = person_id + self.communityId = communityId + self.personId = personId self.ban = ban - self.remove_data = remove_data + self.removeData = removeData self.reason = reason self.expires = expires - self.auth = auth } } public struct BanFromCommunityResponse: APIResponse { - public let person_view: PersonView + public let personView: PersonView public let banned: Bool public init( - person_view: PersonView, + personView: PersonView, banned: Bool ) { - self.person_view = person_view + self.personView = personView self.banned = banned } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/BanPerson.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/BanPerson.swift index 7ec5495..2e1f9cc 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/BanPerson.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/BanPerson.swift @@ -6,39 +6,36 @@ public struct BanPersonRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/user/ban" - public let person_id: PersonId + public let personId: PersonId public let ban: Bool - public let remove_data: Bool? + public let removeData: Bool? public let reason: String? public let expires: Int? - public let auth: String public init( - person_id: PersonId, + personId: PersonId, ban: Bool, - remove_data: Bool? = nil, + removeData: Bool? = nil, reason: String? = nil, - expires: Int? = nil, - auth: String + expires: Int? = nil ) { - self.person_id = person_id + self.personId = personId self.ban = ban - self.remove_data = remove_data + self.removeData = removeData self.reason = reason self.expires = expires - self.auth = auth } } public struct BanPersonResponse: APIResponse { - public let person_view: PersonView + public let personView: PersonView public let banned: Bool public init( - person_view: PersonView, + personView: PersonView, banned: Bool ) { - self.person_view = person_view + self.personView = personView self.banned = banned } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/BlockCommunity.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/BlockCommunity.swift index fe8775d..1ab3deb 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/BlockCommunity.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/BlockCommunity.swift @@ -6,30 +6,27 @@ public struct BlockCommunityRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/community/block" - public let community_id: CommunityId + public let communityId: CommunityId public let block: Bool - public let auth: String public init( - community_id: CommunityId, - block: Bool, - auth: String + communityId: CommunityId, + block: Bool ) { - self.community_id = community_id + self.communityId = communityId self.block = block - self.auth = auth } } public struct BlockCommunityResponse: APIResponse { - public let community_view: CommunityView + public let communityView: CommunityView public let blocked: Bool public init( - community_view: CommunityView, + communityView: CommunityView, blocked: Bool ) { - self.community_view = community_view + self.communityView = communityView self.blocked = blocked } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/BlockInstance.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/BlockInstance.swift new file mode 100644 index 0000000..8459666 --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/BlockInstance.swift @@ -0,0 +1,29 @@ +import Foundation + +public struct BlockInstanceRequest: APIRequest { + public typealias Response = BlockInstanceResponse + + public static let httpMethod: HTTPMethod = .post + public static let path: String = "/site/block" + + public let instanceId: InstanceId + public let block: Bool + + public init( + instanceId: InstanceId, + block: Bool + ) { + self.instanceId = instanceId + self.block = block + } +} + +public struct BlockInstanceResponse: APIResponse { + public let blocked: Bool + + public init( + blocked: Bool + ) { + self.blocked = blocked + } +} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/BlockPerson.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/BlockPerson.swift index ac9b8f8..632116a 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/BlockPerson.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/BlockPerson.swift @@ -6,30 +6,27 @@ public struct BlockPersonRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/user/block" - public let person_id: PersonId + public let personId: PersonId public let block: Bool - public let auth: String public init( - person_id: PersonId, - block: Bool, - auth: String + personId: PersonId, + block: Bool ) { - self.person_id = person_id + self.personId = personId self.block = block - self.auth = auth } } public struct BlockPersonResponse: APIResponse { - public let person_view: PersonView + public let personView: PersonView public let blocked: Bool public init( - person_view: PersonView, + personView: PersonView, blocked: Bool ) { - self.person_view = person_view + self.personView = personView self.blocked = blocked } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ChangePassword.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ChangePassword.swift index 2df5999..d28263b 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ChangePassword.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ChangePassword.swift @@ -6,20 +6,17 @@ public struct ChangePasswordRequest: APIRequest { public static let httpMethod: HTTPMethod = .put public static let path: String = "/user/change_password" - public let new_password: String - public let new_password_verify: String - public let old_password: String - public let auth: String + public let newPassword: String + public let newPasswordVerify: String + public let oldPassword: String public init( - new_password: String, - new_password_verify: String, - old_password: String, - auth: String + newPassword: String, + newPasswordVerify: String, + oldPassword: String ) { - self.new_password = new_password - self.new_password_verify = new_password_verify - self.old_password = old_password - self.auth = auth + self.newPassword = newPassword + self.newPasswordVerify = newPasswordVerify + self.oldPassword = oldPassword } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateComment.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateComment.swift index 5f4bdf1..70c37f7 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateComment.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateComment.swift @@ -7,41 +7,32 @@ public struct CreateCommentRequest: APIRequest { public static let path: String = "/comment" public let content: String - public let post_id: PostId - public let parent_id: CommentId? - public let language_id: LanguageId? - public let form_id: String? - public let auth: String + public let postId: PostId + public let parentId: CommentId? + public let languageId: LanguageId? public init( content: String, - post_id: PostId, - parent_id: CommentId? = nil, - language_id: LanguageId? = nil, - form_id: String? = nil, - auth: String + postId: PostId, + parentId: CommentId? = nil, + languageId: LanguageId? = nil ) { self.content = content - self.post_id = post_id - self.parent_id = parent_id - self.language_id = language_id - self.form_id = form_id - self.auth = auth + self.postId = postId + self.parentId = parentId + self.languageId = languageId } } public struct CommentResponse: APIResponse { - public let comment_view: CommentView - public let recipient_ids: [LocalUserId] - public let form_id: String? + public let commentView: CommentView + public let recipientIds: [LocalUserId] public init( - comment_view: CommentView, - recipient_ids: [LocalUserId], - form_id: String? = nil + commentView: CommentView, + recipientIds: [LocalUserId] ) { - self.comment_view = comment_view - self.recipient_ids = recipient_ids - self.form_id = form_id + self.commentView = commentView + self.recipientIds = recipientIds } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateCommentLike.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateCommentLike.swift index 45fc3c6..dcbcf50 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateCommentLike.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateCommentLike.swift @@ -6,17 +6,14 @@ public struct CreateCommentLikeRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/comment/like" - public let comment_id: CommentId + public let commentId: CommentId public let score: Int - public let auth: String public init( - comment_id: CommentId, - score: Int, - auth: String + commentId: CommentId, + score: Int ) { - self.comment_id = comment_id + self.commentId = commentId self.score = score - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateCommentReport.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateCommentReport.swift index b00a569..84cf094 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateCommentReport.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateCommentReport.swift @@ -6,27 +6,24 @@ public struct CreateCommentReportRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/comment/report" - public let comment_id: CommentId + public let commentId: CommentId public let reason: String - public let auth: String public init( - comment_id: CommentId, - reason: String, - auth: String + commentId: CommentId, + reason: String ) { - self.comment_id = comment_id + self.commentId = commentId self.reason = reason - self.auth = auth } } public struct CommentReportResponse: APIResponse { - public let comment_report_view: CommentReportView + public let commentReportView: CommentReportView public init( - comment_report_view: CommentReportView + commentReportView: CommentReportView ) { - self.comment_report_view = comment_report_view + self.commentReportView = commentReportView } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateCommunity.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateCommunity.swift index 47e890e..d729bb5 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateCommunity.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateCommunity.swift @@ -12,9 +12,8 @@ public struct CreateCommunityRequest: APIRequest { public let icon: String? public let banner: String? public let nsfw: Bool? - public let posting_restricted_to_mods: Bool? - public let discussion_languages: [LanguageId]? - public let auth: String + public let postingRestrictedToMods: Bool? + public let discussionLanguages: [LanguageId]? public init( name: String, @@ -23,9 +22,8 @@ public struct CreateCommunityRequest: APIRequest { icon: String? = nil, banner: String? = nil, nsfw: Bool? = nil, - posting_restricted_to_mods: Bool? = nil, - discussion_languages: [LanguageId]? = nil, - auth: String + postingRestrictedToMods: Bool? = nil, + discussionLanguages: [LanguageId]? = nil ) { self.name = name self.title = title @@ -33,21 +31,20 @@ public struct CreateCommunityRequest: APIRequest { self.icon = icon self.banner = banner self.nsfw = nsfw - self.posting_restricted_to_mods = posting_restricted_to_mods - self.discussion_languages = discussion_languages - self.auth = auth + self.postingRestrictedToMods = postingRestrictedToMods + self.discussionLanguages = discussionLanguages } } public struct CommunityResponse: APIResponse { - public let community_view: CommunityView - public let discussion_languages: [LanguageId] + public let communityView: CommunityView + public let discussionLanguages: [LanguageId] public init( - community_view: CommunityView, - discussion_languages: [LanguageId] + communityView: CommunityView, + discussionLanguages: [LanguageId] ) { - self.community_view = community_view - self.discussion_languages = discussion_languages + self.communityView = communityView + self.discussionLanguages = discussionLanguages } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateCustomEmoji.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateCustomEmoji.swift index e42871e..61fa4d4 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateCustomEmoji.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateCustomEmoji.swift @@ -8,34 +8,31 @@ public struct CreateCustomEmojiRequest: APIRequest { public let category: String public let shortcode: String - public let image_url: String - public let alt_text: String + public let imageUrl: String + public let altText: String public let keywords: [String] - public let auth: String public init( category: String, shortcode: String, - image_url: String, - alt_text: String, - keywords: [String], - auth: String + imageUrl: String, + altText: String, + keywords: [String] ) { self.category = category self.shortcode = shortcode - self.image_url = image_url - self.alt_text = alt_text + self.imageUrl = imageUrl + self.altText = altText self.keywords = keywords - self.auth = auth } } public struct CustomEmojiResponse: APIResponse { - public let custom_emoji: CustomEmojiView + public let customEmoji: CustomEmojiView public init( - custom_emoji: CustomEmojiView + customEmoji: CustomEmojiView ) { - self.custom_emoji = custom_emoji + self.customEmoji = customEmoji } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreatePost.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreatePost.swift index 3574d8e..ab35328 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreatePost.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreatePost.swift @@ -7,41 +7,38 @@ public struct CreatePostRequest: APIRequest { public static let path: String = "/post" public let name: String - public let community_id: CommunityId + public let communityId: CommunityId public let url: String? public let body: String? public let honeypot: String? public let nsfw: Bool? - public let language_id: LanguageId? - public let auth: String + public let languageId: LanguageId? public init( name: String, - community_id: CommunityId, + communityId: CommunityId, url: String? = nil, body: String? = nil, honeypot: String? = nil, nsfw: Bool? = nil, - language_id: LanguageId? = nil, - auth: String + languageId: LanguageId? = nil ) { self.name = name - self.community_id = community_id + self.communityId = communityId self.url = url self.body = body self.honeypot = honeypot self.nsfw = nsfw - self.language_id = language_id - self.auth = auth + self.languageId = languageId } } public struct PostResponse: APIResponse { - public let post_view: PostView + public let postView: PostView public init( - post_view: PostView + postView: PostView ) { - self.post_view = post_view + self.postView = postView } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreatePostLike.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreatePostLike.swift index decad2a..955cac5 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreatePostLike.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreatePostLike.swift @@ -6,17 +6,14 @@ public struct CreatePostLikeRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/post/like" - public let post_id: PostId + public let postId: PostId public let score: Int - public let auth: String public init( - post_id: PostId, - score: Int, - auth: String + postId: PostId, + score: Int ) { - self.post_id = post_id + self.postId = postId self.score = score - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreatePostReport.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreatePostReport.swift index 90a0e50..b8b5aae 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreatePostReport.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreatePostReport.swift @@ -6,27 +6,24 @@ public struct CreatePostReportRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/post/report" - public let post_id: PostId + public let postId: PostId public let reason: String - public let auth: String public init( - post_id: PostId, - reason: String, - auth: String + postId: PostId, + reason: String ) { - self.post_id = post_id + self.postId = postId self.reason = reason - self.auth = auth } } public struct PostReportResponse: APIResponse { - public let post_report_view: PostReportView + public let postReportView: PostReportView public init( - post_report_view: PostReportView + postReportView: PostReportView ) { - self.post_report_view = post_report_view + self.postReportView = postReportView } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreatePrivateMessage.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreatePrivateMessage.swift index 86ac23a..d7790bf 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreatePrivateMessage.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreatePrivateMessage.swift @@ -7,26 +7,23 @@ public struct CreatePrivateMessageRequest: APIRequest { public static let path: String = "/private_message" public let content: String - public let recipient_id: PersonId - public let auth: String + public let recipientId: PersonId public init( content: String, - recipient_id: PersonId, - auth: String + recipientId: PersonId ) { self.content = content - self.recipient_id = recipient_id - self.auth = auth + self.recipientId = recipientId } } public struct PrivateMessageResponse: APIResponse { - public let private_message_view: PrivateMessageView + public let privateMessageView: PrivateMessageView public init( - private_message_view: PrivateMessageView + privateMessageView: PrivateMessageView ) { - self.private_message_view = private_message_view + self.privateMessageView = privateMessageView } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateSite.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateSite.swift index e22608f..50dd972 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateSite.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/CreateSite.swift @@ -11,41 +11,40 @@ public struct CreateSiteRequest: APIRequest { public let description: String? public let icon: String? public let banner: String? - public let enable_downvotes: Bool? - public let enable_nsfw: Bool? - public let community_creation_admin_only: Bool? - public let require_email_verification: Bool? - public let application_question: String? - public let private_instance: Bool? - public let default_theme: String? - public let default_post_listing_type: ListingType? - public let legal_information: String? - public let application_email_admins: Bool? - public let hide_modlog_mod_names: Bool? - public let discussion_languages: [LanguageId]? - public let slur_filter_regex: String? - public let actor_name_max_length: Int? - public let rate_limit_message: Int? - public let rate_limit_message_per_second: Int? - public let rate_limit_post: Int? - public let rate_limit_post_per_second: Int? - public let rate_limit_register: Int? - public let rate_limit_register_per_second: Int? - public let rate_limit_image: Int? - public let rate_limit_image_per_second: Int? - public let rate_limit_comment: Int? - public let rate_limit_comment_per_second: Int? - public let rate_limit_search: Int? - public let rate_limit_search_per_second: Int? - public let federation_enabled: Bool? - public let federation_debug: Bool? - public let captcha_enabled: Bool? - public let captcha_difficulty: String? - public let allowed_instances: [String]? - public let blocked_instances: [String]? + public let enableDownvotes: Bool? + public let enableNsfw: Bool? + public let communityCreationAdminOnly: Bool? + public let requireEmailVerification: Bool? + public let applicationQuestion: String? + public let privateInstance: Bool? + public let defaultTheme: String? + public let defaultPostListingType: ListingType? + public let legalInformation: String? + public let applicationEmailAdmins: Bool? + public let hideModlogModNames: Bool? + public let discussionLanguages: [LanguageId]? + public let slurFilterRegex: String? + public let actorNameMaxLength: Int? + public let rateLimitMessage: Int? + public let rateLimitMessagePerSecond: Int? + public let rateLimitPost: Int? + public let rateLimitPostPerSecond: Int? + public let rateLimitRegister: Int? + public let rateLimitRegisterPerSecond: Int? + public let rateLimitImage: Int? + public let rateLimitImagePerSecond: Int? + public let rateLimitComment: Int? + public let rateLimitCommentPerSecond: Int? + public let rateLimitSearch: Int? + public let rateLimitSearchPerSecond: Int? + public let federationEnabled: Bool? + public let federationDebug: Bool? + public let captchaEnabled: Bool? + public let captchaDifficulty: String? + public let allowedInstances: [String]? + public let blockedInstances: [String]? public let taglines: [String]? - public let registration_mode: RegistrationMode? - public let auth: String + public let registrationMode: RegistrationMode? public init( name: String, @@ -53,94 +52,92 @@ public struct CreateSiteRequest: APIRequest { description: String? = nil, icon: String? = nil, banner: String? = nil, - enable_downvotes: Bool? = nil, - enable_nsfw: Bool? = nil, - community_creation_admin_only: Bool? = nil, - require_email_verification: Bool? = nil, - application_question: String? = nil, - private_instance: Bool? = nil, - default_theme: String? = nil, - default_post_listing_type: ListingType? = nil, - legal_information: String? = nil, - application_email_admins: Bool? = nil, - hide_modlog_mod_names: Bool? = nil, - discussion_languages: [LanguageId]? = nil, - slur_filter_regex: String? = nil, - actor_name_max_length: Int? = nil, - rate_limit_message: Int? = nil, - rate_limit_message_per_second: Int? = nil, - rate_limit_post: Int? = nil, - rate_limit_post_per_second: Int? = nil, - rate_limit_register: Int? = nil, - rate_limit_register_per_second: Int? = nil, - rate_limit_image: Int? = nil, - rate_limit_image_per_second: Int? = nil, - rate_limit_comment: Int? = nil, - rate_limit_comment_per_second: Int? = nil, - rate_limit_search: Int? = nil, - rate_limit_search_per_second: Int? = nil, - federation_enabled: Bool? = nil, - federation_debug: Bool? = nil, - captcha_enabled: Bool? = nil, - captcha_difficulty: String? = nil, - allowed_instances: [String]? = nil, - blocked_instances: [String]? = nil, + enableDownvotes: Bool? = nil, + enableNsfw: Bool? = nil, + communityCreationAdminOnly: Bool? = nil, + requireEmailVerification: Bool? = nil, + applicationQuestion: String? = nil, + privateInstance: Bool? = nil, + defaultTheme: String? = nil, + defaultPostListingType: ListingType? = nil, + legalInformation: String? = nil, + applicationEmailAdmins: Bool? = nil, + hideModlogModNames: Bool? = nil, + discussionLanguages: [LanguageId]? = nil, + slurFilterRegex: String? = nil, + actorNameMaxLength: Int? = nil, + rateLimitMessage: Int? = nil, + rateLimitMessagePerSecond: Int? = nil, + rateLimitPost: Int? = nil, + rateLimitPostPerSecond: Int? = nil, + rateLimitRegister: Int? = nil, + rateLimitRegisterPerSecond: Int? = nil, + rateLimitImage: Int? = nil, + rateLimitImagePerSecond: Int? = nil, + rateLimitComment: Int? = nil, + rateLimitCommentPerSecond: Int? = nil, + rateLimitSearch: Int? = nil, + rateLimitSearchPerSecond: Int? = nil, + federationEnabled: Bool? = nil, + federationDebug: Bool? = nil, + captchaEnabled: Bool? = nil, + captchaDifficulty: String? = nil, + allowedInstances: [String]? = nil, + blockedInstances: [String]? = nil, taglines: [String]? = nil, - registration_mode: RegistrationMode? = nil, - auth: String + registrationMode: RegistrationMode? = nil ) { self.name = name self.sidebar = sidebar self.description = description self.icon = icon self.banner = banner - self.enable_downvotes = enable_downvotes - self.enable_nsfw = enable_nsfw - self.community_creation_admin_only = community_creation_admin_only - self.require_email_verification = require_email_verification - self.application_question = application_question - self.private_instance = private_instance - self.default_theme = default_theme - self.default_post_listing_type = default_post_listing_type - self.legal_information = legal_information - self.application_email_admins = application_email_admins - self.hide_modlog_mod_names = hide_modlog_mod_names - self.discussion_languages = discussion_languages - self.slur_filter_regex = slur_filter_regex - self.actor_name_max_length = actor_name_max_length - self.rate_limit_message = rate_limit_message - self.rate_limit_message_per_second = rate_limit_message_per_second - self.rate_limit_post = rate_limit_post - self.rate_limit_post_per_second = rate_limit_post_per_second - self.rate_limit_register = rate_limit_register - self.rate_limit_register_per_second = rate_limit_register_per_second - self.rate_limit_image = rate_limit_image - self.rate_limit_image_per_second = rate_limit_image_per_second - self.rate_limit_comment = rate_limit_comment - self.rate_limit_comment_per_second = rate_limit_comment_per_second - self.rate_limit_search = rate_limit_search - self.rate_limit_search_per_second = rate_limit_search_per_second - self.federation_enabled = federation_enabled - self.federation_debug = federation_debug - self.captcha_enabled = captcha_enabled - self.captcha_difficulty = captcha_difficulty - self.allowed_instances = allowed_instances - self.blocked_instances = blocked_instances + self.enableDownvotes = enableDownvotes + self.enableNsfw = enableNsfw + self.communityCreationAdminOnly = communityCreationAdminOnly + self.requireEmailVerification = requireEmailVerification + self.applicationQuestion = applicationQuestion + self.privateInstance = privateInstance + self.defaultTheme = defaultTheme + self.defaultPostListingType = defaultPostListingType + self.legalInformation = legalInformation + self.applicationEmailAdmins = applicationEmailAdmins + self.hideModlogModNames = hideModlogModNames + self.discussionLanguages = discussionLanguages + self.slurFilterRegex = slurFilterRegex + self.actorNameMaxLength = actorNameMaxLength + self.rateLimitMessage = rateLimitMessage + self.rateLimitMessagePerSecond = rateLimitMessagePerSecond + self.rateLimitPost = rateLimitPost + self.rateLimitPostPerSecond = rateLimitPostPerSecond + self.rateLimitRegister = rateLimitRegister + self.rateLimitRegisterPerSecond = rateLimitRegisterPerSecond + self.rateLimitImage = rateLimitImage + self.rateLimitImagePerSecond = rateLimitImagePerSecond + self.rateLimitComment = rateLimitComment + self.rateLimitCommentPerSecond = rateLimitCommentPerSecond + self.rateLimitSearch = rateLimitSearch + self.rateLimitSearchPerSecond = rateLimitSearchPerSecond + self.federationEnabled = federationEnabled + self.federationDebug = federationDebug + self.captchaEnabled = captchaEnabled + self.captchaDifficulty = captchaDifficulty + self.allowedInstances = allowedInstances + self.blockedInstances = blockedInstances self.taglines = taglines - self.registration_mode = registration_mode - self.auth = auth + self.registrationMode = registrationMode } } public struct SiteResponse: APIResponse { - public let site_view: SiteView + public let siteView: SiteView public let taglines: [Tagline] public init( - site_view: SiteView, + siteView: SiteView, taglines: [Tagline] ) { - self.site_view = site_view + self.siteView = siteView self.taglines = taglines } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeleteAccount.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeleteAccount.swift index fb636e8..964a8c1 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeleteAccount.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeleteAccount.swift @@ -1,23 +1,19 @@ import Foundation public struct DeleteAccountRequest: APIRequest { - public typealias Response = DeleteAccountResponse + public typealias Response = SuccessResponse public static let httpMethod: HTTPMethod = .post public static let path: String = "/user/delete_account" public let password: String - public let auth: String + public let deleteContent: Bool public init( password: String, - auth: String + deleteContent: Bool ) { self.password = password - self.auth = auth + self.deleteContent = deleteContent } } - -public struct DeleteAccountResponse: APIResponse { - public init() {} -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeleteComment.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeleteComment.swift index a5e7821..1828bf5 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeleteComment.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeleteComment.swift @@ -6,17 +6,14 @@ public struct DeleteCommentRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/comment/delete" - public let comment_id: CommentId + public let commentId: CommentId public let deleted: Bool - public let auth: String public init( - comment_id: CommentId, - deleted: Bool, - auth: String + commentId: CommentId, + deleted: Bool ) { - self.comment_id = comment_id + self.commentId = commentId self.deleted = deleted - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeleteCommunity.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeleteCommunity.swift index 4fb53d7..cdb664c 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeleteCommunity.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeleteCommunity.swift @@ -6,17 +6,14 @@ public struct DeleteCommunityRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/community/delete" - public let community_id: CommunityId + public let communityId: CommunityId public let deleted: Bool - public let auth: String public init( - community_id: CommunityId, - deleted: Bool, - auth: String + communityId: CommunityId, + deleted: Bool ) { - self.community_id = community_id + self.communityId = communityId self.deleted = deleted - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeleteCustomEmoji.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeleteCustomEmoji.swift index 201e3b4..81d747d 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeleteCustomEmoji.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeleteCustomEmoji.swift @@ -1,32 +1,16 @@ import Foundation public struct DeleteCustomEmojiRequest: APIRequest { - public typealias Response = DeleteCustomEmojiResponse + public typealias Response = SuccessResponse public static let httpMethod: HTTPMethod = .post public static let path: String = "/custom_emoji/delete" public let id: CustomEmojiId - public let auth: String public init( - id: CustomEmojiId, - auth: String + id: CustomEmojiId ) { self.id = id - self.auth = auth - } -} - -public struct DeleteCustomEmojiResponse: APIResponse { - public let id: CustomEmojiId - public let success: Bool - - public init( - id: CustomEmojiId, - success: Bool - ) { - self.id = id - self.success = success } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeletePost.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeletePost.swift index 50550f6..987f356 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeletePost.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeletePost.swift @@ -6,17 +6,14 @@ public struct DeletePostRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/post/delete" - public let post_id: PostId + public let postId: PostId public let deleted: Bool - public let auth: String public init( - post_id: PostId, - deleted: Bool, - auth: String + postId: PostId, + deleted: Bool ) { - self.post_id = post_id + self.postId = postId self.deleted = deleted - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeletePrivateMessage.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeletePrivateMessage.swift index e31433d..452b408 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeletePrivateMessage.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DeletePrivateMessage.swift @@ -6,17 +6,14 @@ public struct DeletePrivateMessageRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/private_message/delete" - public let private_message_id: PrivateMessageId + public let privateMessageId: PrivateMessageId public let deleted: Bool - public let auth: String public init( - private_message_id: PrivateMessageId, - deleted: Bool, - auth: String + privateMessageId: PrivateMessageId, + deleted: Bool ) { - self.private_message_id = private_message_id + self.privateMessageId = privateMessageId self.deleted = deleted - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DistinguishComment.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DistinguishComment.swift index 28d8cc8..95693bf 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DistinguishComment.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/DistinguishComment.swift @@ -6,17 +6,14 @@ public struct DistinguishCommentRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/comment/distinguish" - public let comment_id: CommentId + public let commentId: CommentId public let distinguished: Bool - public let auth: String public init( - comment_id: CommentId, - distinguished: Bool, - auth: String + commentId: CommentId, + distinguished: Bool ) { - self.comment_id = comment_id + self.commentId = commentId self.distinguished = distinguished - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditComment.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditComment.swift index d844c8b..18988f8 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditComment.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditComment.swift @@ -6,23 +6,17 @@ public struct EditCommentRequest: APIRequest { public static let httpMethod: HTTPMethod = .put public static let path: String = "/comment" - public let comment_id: CommentId + public let commentId: CommentId public let content: String? - public let language_id: LanguageId? - public let form_id: String? - public let auth: String + public let languageId: LanguageId? public init( - comment_id: CommentId, + commentId: CommentId, content: String? = nil, - language_id: LanguageId? = nil, - form_id: String? = nil, - auth: String + languageId: LanguageId? = nil ) { - self.comment_id = comment_id + self.commentId = commentId self.content = content - self.language_id = language_id - self.form_id = form_id - self.auth = auth + self.languageId = languageId } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditCommunity.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditCommunity.swift index d51f58e..257ea62 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditCommunity.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditCommunity.swift @@ -6,35 +6,32 @@ public struct EditCommunityRequest: APIRequest { public static let httpMethod: HTTPMethod = .put public static let path: String = "/community" - public let community_id: CommunityId + public let communityId: CommunityId public let title: String? public let description: String? public let icon: String? public let banner: String? public let nsfw: Bool? - public let posting_restricted_to_mods: Bool? - public let discussion_languages: [LanguageId]? - public let auth: String + public let postingRestrictedToMods: Bool? + public let discussionLanguages: [LanguageId]? public init( - community_id: CommunityId, + communityId: CommunityId, title: String? = nil, description: String? = nil, icon: String? = nil, banner: String? = nil, nsfw: Bool? = nil, - posting_restricted_to_mods: Bool? = nil, - discussion_languages: [LanguageId]? = nil, - auth: String + postingRestrictedToMods: Bool? = nil, + discussionLanguages: [LanguageId]? = nil ) { - self.community_id = community_id + self.communityId = communityId self.title = title self.description = description self.icon = icon self.banner = banner self.nsfw = nsfw - self.posting_restricted_to_mods = posting_restricted_to_mods - self.discussion_languages = discussion_languages - self.auth = auth + self.postingRestrictedToMods = postingRestrictedToMods + self.discussionLanguages = discussionLanguages } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditCustomEmoji.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditCustomEmoji.swift index 7455e92..72e4ef1 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditCustomEmoji.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditCustomEmoji.swift @@ -8,24 +8,21 @@ public struct EditCustomEmojiRequest: APIRequest { public let id: CustomEmojiId public let category: String - public let image_url: String - public let alt_text: String + public let imageUrl: String + public let altText: String public let keywords: [String] - public let auth: String public init( id: CustomEmojiId, category: String, - image_url: String, - alt_text: String, - keywords: [String], - auth: String + imageUrl: String, + altText: String, + keywords: [String] ) { self.id = id self.category = category - self.image_url = image_url - self.alt_text = alt_text + self.imageUrl = imageUrl + self.altText = altText self.keywords = keywords - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditPost.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditPost.swift index 5a0d437..f210c1f 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditPost.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditPost.swift @@ -6,29 +6,26 @@ public struct EditPostRequest: APIRequest { public static let httpMethod: HTTPMethod = .put public static let path: String = "/post" - public let post_id: PostId + public let postId: PostId public let name: String? public let url: String? public let body: String? public let nsfw: Bool? - public let language_id: LanguageId? - public let auth: String + public let languageId: LanguageId? public init( - post_id: PostId, + postId: PostId, name: String? = nil, url: String? = nil, body: String? = nil, nsfw: Bool? = nil, - language_id: LanguageId? = nil, - auth: String + languageId: LanguageId? = nil ) { - self.post_id = post_id + self.postId = postId self.name = name self.url = url self.body = body self.nsfw = nsfw - self.language_id = language_id - self.auth = auth + self.languageId = languageId } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditPrivateMessage.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditPrivateMessage.swift index 8894447..b1be8bd 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditPrivateMessage.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditPrivateMessage.swift @@ -6,17 +6,14 @@ public struct EditPrivateMessageRequest: APIRequest { public static let httpMethod: HTTPMethod = .put public static let path: String = "/private_message" - public let private_message_id: PrivateMessageId + public let privateMessageId: PrivateMessageId public let content: String - public let auth: String public init( - private_message_id: PrivateMessageId, - content: String, - auth: String + privateMessageId: PrivateMessageId, + content: String ) { - self.private_message_id = private_message_id + self.privateMessageId = privateMessageId self.content = content - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditSite.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditSite.swift index b9d0ab6..1450577 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditSite.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/EditSite.swift @@ -11,42 +11,41 @@ public struct EditSiteRequest: APIRequest { public let description: String? public let icon: String? public let banner: String? - public let enable_downvotes: Bool? - public let enable_nsfw: Bool? - public let community_creation_admin_only: Bool? - public let require_email_verification: Bool? - public let application_question: String? - public let private_instance: Bool? - public let default_theme: String? - public let default_post_listing_type: ListingType? - public let legal_information: String? - public let application_email_admins: Bool? - public let hide_modlog_mod_names: Bool? - public let discussion_languages: [LanguageId]? - public let slur_filter_regex: String? - public let actor_name_max_length: Int? - public let rate_limit_message: Int? - public let rate_limit_message_per_second: Int? - public let rate_limit_post: Int? - public let rate_limit_post_per_second: Int? - public let rate_limit_register: Int? - public let rate_limit_register_per_second: Int? - public let rate_limit_image: Int? - public let rate_limit_image_per_second: Int? - public let rate_limit_comment: Int? - public let rate_limit_comment_per_second: Int? - public let rate_limit_search: Int? - public let rate_limit_search_per_second: Int? - public let federation_enabled: Bool? - public let federation_debug: Bool? - public let captcha_enabled: Bool? - public let captcha_difficulty: String? - public let allowed_instances: [String]? - public let blocked_instances: [String]? + public let enableDownvotes: Bool? + public let enableNsfw: Bool? + public let communityCreationAdminOnly: Bool? + public let requireEmailVerification: Bool? + public let applicationQuestion: String? + public let privateInstance: Bool? + public let defaultTheme: String? + public let defaultPostListingType: ListingType? + public let legalInformation: String? + public let applicationEmailAdmins: Bool? + public let hideModlogModNames: Bool? + public let discussionLanguages: [LanguageId]? + public let slurFilterRegex: String? + public let actorNameMaxLength: Int? + public let rateLimitMessage: Int? + public let rateLimitMessagePerSecond: Int? + public let rateLimitPost: Int? + public let rateLimitPostPerSecond: Int? + public let rateLimitRegister: Int? + public let rateLimitRegisterPerSecond: Int? + public let rateLimitImage: Int? + public let rateLimitImagePerSecond: Int? + public let rateLimitComment: Int? + public let rateLimitCommentPerSecond: Int? + public let rateLimitSearch: Int? + public let rateLimitSearchPerSecond: Int? + public let federationEnabled: Bool? + public let federationDebug: Bool? + public let captchaEnabled: Bool? + public let captchaDifficulty: String? + public let allowedInstances: [String]? + public let blockedInstances: [String]? public let taglines: [String]? - public let registration_mode: RegistrationMode? - public let reports_email_admins: Bool? - public let auth: String + public let registrationMode: RegistrationMode? + public let reportsEmailAdmins: Bool? public init( name: String? = nil, @@ -54,83 +53,81 @@ public struct EditSiteRequest: APIRequest { description: String? = nil, icon: String? = nil, banner: String? = nil, - enable_downvotes: Bool? = nil, - enable_nsfw: Bool? = nil, - community_creation_admin_only: Bool? = nil, - require_email_verification: Bool? = nil, - application_question: String? = nil, - private_instance: Bool? = nil, - default_theme: String? = nil, - default_post_listing_type: ListingType? = nil, - legal_information: String? = nil, - application_email_admins: Bool? = nil, - hide_modlog_mod_names: Bool? = nil, - discussion_languages: [LanguageId]? = nil, - slur_filter_regex: String? = nil, - actor_name_max_length: Int? = nil, - rate_limit_message: Int? = nil, - rate_limit_message_per_second: Int? = nil, - rate_limit_post: Int? = nil, - rate_limit_post_per_second: Int? = nil, - rate_limit_register: Int? = nil, - rate_limit_register_per_second: Int? = nil, - rate_limit_image: Int? = nil, - rate_limit_image_per_second: Int? = nil, - rate_limit_comment: Int? = nil, - rate_limit_comment_per_second: Int? = nil, - rate_limit_search: Int? = nil, - rate_limit_search_per_second: Int? = nil, - federation_enabled: Bool? = nil, - federation_debug: Bool? = nil, - captcha_enabled: Bool? = nil, - captcha_difficulty: String? = nil, - allowed_instances: [String]? = nil, - blocked_instances: [String]? = nil, + enableDownvotes: Bool? = nil, + enableNsfw: Bool? = nil, + communityCreationAdminOnly: Bool? = nil, + requireEmailVerification: Bool? = nil, + applicationQuestion: String? = nil, + privateInstance: Bool? = nil, + defaultTheme: String? = nil, + defaultPostListingType: ListingType? = nil, + legalInformation: String? = nil, + applicationEmailAdmins: Bool? = nil, + hideModlogModNames: Bool? = nil, + discussionLanguages: [LanguageId]? = nil, + slurFilterRegex: String? = nil, + actorNameMaxLength: Int? = nil, + rateLimitMessage: Int? = nil, + rateLimitMessagePerSecond: Int? = nil, + rateLimitPost: Int? = nil, + rateLimitPostPerSecond: Int? = nil, + rateLimitRegister: Int? = nil, + rateLimitRegisterPerSecond: Int? = nil, + rateLimitImage: Int? = nil, + rateLimitImagePerSecond: Int? = nil, + rateLimitComment: Int? = nil, + rateLimitCommentPerSecond: Int? = nil, + rateLimitSearch: Int? = nil, + rateLimitSearchPerSecond: Int? = nil, + federationEnabled: Bool? = nil, + federationDebug: Bool? = nil, + captchaEnabled: Bool? = nil, + captchaDifficulty: String? = nil, + allowedInstances: [String]? = nil, + blockedInstances: [String]? = nil, taglines: [String]? = nil, - registration_mode: RegistrationMode? = nil, - reports_email_admins: Bool? = nil, - auth: String + registrationMode: RegistrationMode? = nil, + reportsEmailAdmins: Bool? = nil ) { self.name = name self.sidebar = sidebar self.description = description self.icon = icon self.banner = banner - self.enable_downvotes = enable_downvotes - self.enable_nsfw = enable_nsfw - self.community_creation_admin_only = community_creation_admin_only - self.require_email_verification = require_email_verification - self.application_question = application_question - self.private_instance = private_instance - self.default_theme = default_theme - self.default_post_listing_type = default_post_listing_type - self.legal_information = legal_information - self.application_email_admins = application_email_admins - self.hide_modlog_mod_names = hide_modlog_mod_names - self.discussion_languages = discussion_languages - self.slur_filter_regex = slur_filter_regex - self.actor_name_max_length = actor_name_max_length - self.rate_limit_message = rate_limit_message - self.rate_limit_message_per_second = rate_limit_message_per_second - self.rate_limit_post = rate_limit_post - self.rate_limit_post_per_second = rate_limit_post_per_second - self.rate_limit_register = rate_limit_register - self.rate_limit_register_per_second = rate_limit_register_per_second - self.rate_limit_image = rate_limit_image - self.rate_limit_image_per_second = rate_limit_image_per_second - self.rate_limit_comment = rate_limit_comment - self.rate_limit_comment_per_second = rate_limit_comment_per_second - self.rate_limit_search = rate_limit_search - self.rate_limit_search_per_second = rate_limit_search_per_second - self.federation_enabled = federation_enabled - self.federation_debug = federation_debug - self.captcha_enabled = captcha_enabled - self.captcha_difficulty = captcha_difficulty - self.allowed_instances = allowed_instances - self.blocked_instances = blocked_instances + self.enableDownvotes = enableDownvotes + self.enableNsfw = enableNsfw + self.communityCreationAdminOnly = communityCreationAdminOnly + self.requireEmailVerification = requireEmailVerification + self.applicationQuestion = applicationQuestion + self.privateInstance = privateInstance + self.defaultTheme = defaultTheme + self.defaultPostListingType = defaultPostListingType + self.legalInformation = legalInformation + self.applicationEmailAdmins = applicationEmailAdmins + self.hideModlogModNames = hideModlogModNames + self.discussionLanguages = discussionLanguages + self.slurFilterRegex = slurFilterRegex + self.actorNameMaxLength = actorNameMaxLength + self.rateLimitMessage = rateLimitMessage + self.rateLimitMessagePerSecond = rateLimitMessagePerSecond + self.rateLimitPost = rateLimitPost + self.rateLimitPostPerSecond = rateLimitPostPerSecond + self.rateLimitRegister = rateLimitRegister + self.rateLimitRegisterPerSecond = rateLimitRegisterPerSecond + self.rateLimitImage = rateLimitImage + self.rateLimitImagePerSecond = rateLimitImagePerSecond + self.rateLimitComment = rateLimitComment + self.rateLimitCommentPerSecond = rateLimitCommentPerSecond + self.rateLimitSearch = rateLimitSearch + self.rateLimitSearchPerSecond = rateLimitSearchPerSecond + self.federationEnabled = federationEnabled + self.federationDebug = federationDebug + self.captchaEnabled = captchaEnabled + self.captchaDifficulty = captchaDifficulty + self.allowedInstances = allowedInstances + self.blockedInstances = blockedInstances self.taglines = taglines - self.registration_mode = registration_mode - self.reports_email_admins = reports_email_admins - self.auth = auth + self.registrationMode = registrationMode + self.reportsEmailAdmins = reportsEmailAdmins } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/FeaturePost.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/FeaturePost.swift index cd956a4..6c98d88 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/FeaturePost.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/FeaturePost.swift @@ -6,20 +6,17 @@ public struct FeaturePostRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/post/feature" - public let post_id: PostId + public let postId: PostId public let featured: Bool - public let feature_type: PostFeatureType - public let auth: String + public let featureType: PostFeatureType public init( - post_id: PostId, + postId: PostId, featured: Bool, - feature_type: PostFeatureType, - auth: String + featureType: PostFeatureType ) { - self.post_id = post_id + self.postId = postId self.featured = featured - self.feature_type = feature_type - self.auth = auth + self.featureType = featureType } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/FollowCommunity.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/FollowCommunity.swift index 86851a8..fb91d16 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/FollowCommunity.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/FollowCommunity.swift @@ -6,17 +6,14 @@ public struct FollowCommunityRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/community/follow" - public let community_id: CommunityId + public let communityId: CommunityId public let follow: Bool - public let auth: String public init( - community_id: CommunityId, - follow: Bool, - auth: String + communityId: CommunityId, + follow: Bool ) { - self.community_id = community_id + self.communityId = communityId self.follow = follow - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetBannedPersons.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetBannedPersons.swift deleted file mode 100644 index 6a70368..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetBannedPersons.swift +++ /dev/null @@ -1,26 +0,0 @@ -import Foundation - -public struct GetBannedPersonsRequest: APIRequest { - public typealias Response = BannedPersonsResponse - - public static let httpMethod: HTTPMethod = .get - public static let path: String = "/user/banned" - - public let auth: String - - public init( - auth: String - ) { - self.auth = auth - } -} - -public struct BannedPersonsResponse: APIResponse { - public let banned: [PersonView] - - public init( - banned: [PersonView] - ) { - self.banned = banned - } -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetCaptcha.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetCaptcha.swift deleted file mode 100644 index 996d6fb..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetCaptcha.swift +++ /dev/null @@ -1,26 +0,0 @@ -import Foundation - -public struct GetCaptchaRequest: APIRequest { - public typealias Response = GetCaptchaResponse - - public static let httpMethod: HTTPMethod = .get - public static let path: String = "/user/get_captcha" - - public let auth: String? - - public init( - auth: String? = nil - ) { - self.auth = auth - } -} - -public struct GetCaptchaResponse: APIResponse { - public let ok: CaptchaResponse? - - public init( - ok: CaptchaResponse? = nil - ) { - self.ok = ok - } -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetComment.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetComment.swift index 55b3437..9fb7daa 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetComment.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetComment.swift @@ -7,13 +7,10 @@ public struct GetCommentRequest: APIRequest { public static let path: String = "/comment" public let id: CommentId - public let auth: String? public init( - id: CommentId, - auth: String? = nil + id: CommentId ) { self.id = id - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetComments.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetComments.swift index a72efff..78e3bd3 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetComments.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetComments.swift @@ -6,42 +6,45 @@ public struct GetCommentsRequest: APIRequest { public static let httpMethod: HTTPMethod = .get public static let path: String = "/comment/list" - public let type_: ListingType? + public let type: ListingType? public let sort: CommentSortType? - public let max_depth: Int? + public let maxDepth: Int? public let page: Int? public let limit: Int? - public let community_id: CommunityId? - public let community_name: String? - public let post_id: PostId? - public let parent_id: CommentId? - public let saved_only: Bool? - public let auth: String? + public let communityId: CommunityId? + public let communityName: String? + public let postId: PostId? + public let parentId: CommentId? + public let savedOnly: Bool? + public let likedOnly: Bool? + public let dislikedOnly: Bool? public init( - type_: ListingType? = nil, + type: ListingType? = nil, sort: CommentSortType? = nil, - max_depth: Int? = nil, + maxDepth: Int? = nil, page: Int? = nil, limit: Int? = nil, - community_id: CommunityId? = nil, - community_name: String? = nil, - post_id: PostId? = nil, - parent_id: CommentId? = nil, - saved_only: Bool? = nil, - auth: String? = nil + communityId: CommunityId? = nil, + communityName: String? = nil, + postId: PostId? = nil, + parentId: CommentId? = nil, + savedOnly: Bool? = nil, + likedOnly: Bool? = nil, + dislikedOnly: Bool? = nil ) { - self.type_ = type_ + self.type = type self.sort = sort - self.max_depth = max_depth + self.maxDepth = maxDepth self.page = page self.limit = limit - self.community_id = community_id - self.community_name = community_name - self.post_id = post_id - self.parent_id = parent_id - self.saved_only = saved_only - self.auth = auth + self.communityId = communityId + self.communityName = communityName + self.postId = postId + self.parentId = parentId + self.savedOnly = savedOnly + self.likedOnly = likedOnly + self.dislikedOnly = dislikedOnly } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetCommunity.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetCommunity.swift index 7519781..e7acd10 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetCommunity.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetCommunity.swift @@ -8,34 +8,31 @@ public struct GetCommunityRequest: APIRequest { public let id: CommunityId? public let name: String? - public let auth: String? public init( id: CommunityId? = nil, - name: String? = nil, - auth: String? = nil + name: String? = nil ) { self.id = id self.name = name - self.auth = auth } } public struct GetCommunityResponse: APIResponse { - public let community_view: CommunityView + public let communityView: CommunityView public let site: Site? public let moderators: [CommunityModeratorView] - public let discussion_languages: [LanguageId] + public let discussionLanguages: [LanguageId] public init( - community_view: CommunityView, + communityView: CommunityView, site: Site? = nil, moderators: [CommunityModeratorView], - discussion_languages: [LanguageId] + discussionLanguages: [LanguageId] ) { - self.community_view = community_view + self.communityView = communityView self.site = site self.moderators = moderators - self.discussion_languages = discussion_languages + self.discussionLanguages = discussionLanguages } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetFederatedInstances.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetFederatedInstances.swift index 8e007af..47cbcce 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetFederatedInstances.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetFederatedInstances.swift @@ -16,11 +16,11 @@ public struct GetFederatedInstancesRequest: APIRequest { } public struct GetFederatedInstancesResponse: APIResponse { - public let federated_instances: FederatedInstances? + public let federatedInstances: FederatedInstances? public init( - federated_instances: FederatedInstances? = nil + federatedInstances: FederatedInstances? = nil ) { - self.federated_instances = federated_instances + self.federatedInstances = federatedInstances } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetModlog.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetModlog.swift index 98000f3..0de8eb1 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetModlog.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetModlog.swift @@ -6,81 +6,78 @@ public struct GetModlogRequest: APIRequest { public static let httpMethod: HTTPMethod = .get public static let path: String = "/modlog" - public let mod_person_id: PersonId? - public let community_id: CommunityId? + public let modPersonId: PersonId? + public let communityId: CommunityId? public let page: Int? public let limit: Int? - public let type_: ModlogActionType? - public let other_person_id: PersonId? - public let auth: String? + public let type: ModlogActionType? + public let otherPersonId: PersonId? public init( - mod_person_id: PersonId? = nil, - community_id: CommunityId? = nil, + modPersonId: PersonId? = nil, + communityId: CommunityId? = nil, page: Int? = nil, limit: Int? = nil, - type_: ModlogActionType? = nil, - other_person_id: PersonId? = nil, - auth: String? = nil + type: ModlogActionType? = nil, + otherPersonId: PersonId? = nil ) { - self.mod_person_id = mod_person_id - self.community_id = community_id + self.modPersonId = modPersonId + self.communityId = communityId self.page = page self.limit = limit - self.type_ = type_ - self.other_person_id = other_person_id - self.auth = auth + self.type = type + self.otherPersonId = otherPersonId } } public struct GetModlogResponse: APIResponse { - public let removed_posts: [ModRemovePostView] - public let locked_posts: [ModLockPostView] - public let featured_posts: [ModFeaturePostView] - public let removed_comments: [ModRemoveCommentView] - public let removed_communities: [ModRemoveCommunityView] - public let banned_from_community: [ModBanFromCommunityView] + public let removedPosts: [ModRemovePostView] + public let lockedPosts: [ModLockPostView] + public let featuredPosts: [ModFeaturePostView] + public let removedComments: [ModRemoveCommentView] + public let removedCommunities: [ModRemoveCommunityView] + public let bannedFromCommunity: [ModBanFromCommunityView] public let banned: [ModBanView] - public let added_to_community: [ModAddCommunityView] - public let transferred_to_community: [ModTransferCommunityView] + public let addedToCommunity: [ModAddCommunityView] + public let transferredToCommunity: [ModTransferCommunityView] public let added: [ModAddView] - public let admin_purged_persons: [AdminPurgePersonView] - public let admin_purged_communities: [AdminPurgeCommunityView] - public let admin_purged_posts: [AdminPurgePostView] - public let admin_purged_comments: [AdminPurgeCommentView] - public let hidden_communities: [ModHideCommunityView] + public let adminPurgedPersons: [AdminPurgePersonView] + public let adminPurgedCommunities: [AdminPurgeCommunityView] + public let adminPurgedPosts: [AdminPurgePostView] + public let adminPurgedComments: [AdminPurgeCommentView] + public let hiddenCommunities: [ModHideCommunityView] public init( - removed_posts: [ModRemovePostView], - locked_posts: [ModLockPostView], - featured_posts: [ModFeaturePostView], - removed_comments: [ModRemoveCommentView], - removed_communities: [ModRemoveCommunityView], - banned_from_community: [ModBanFromCommunityView], + removedPosts: [ModRemovePostView], + lockedPosts: [ModLockPostView], + featuredPosts: [ModFeaturePostView], + removedComments: [ModRemoveCommentView], + removedCommunities: [ModRemoveCommunityView], + bannedFromCommunity: [ModBanFromCommunityView], banned: [ModBanView], - added_to_community: [ModAddCommunityView], - transferred_to_community: [ModTransferCommunityView], + addedToCommunity: [ModAddCommunityView], + transferredToCommunity: [ModTransferCommunityView], added: [ModAddView], - admin_purged_persons: [AdminPurgePersonView], - admin_purged_communities: [AdminPurgeCommunityView], - admin_purged_posts: [AdminPurgePostView], - admin_purged_comments: [AdminPurgeCommentView], - hidden_communities: [ModHideCommunityView] + adminPurgedPersons: [AdminPurgePersonView], + adminPurgedCommunities: [AdminPurgeCommunityView], + adminPurgedPosts: [AdminPurgePostView], + adminPurgedComments: [AdminPurgeCommentView], + hiddenCommunities: [ModHideCommunityView] ) { - self.removed_posts = removed_posts - self.locked_posts = locked_posts - self.featured_posts = featured_posts - self.removed_comments = removed_comments - self.removed_communities = removed_communities - self.banned_from_community = banned_from_community + self.removedPosts = removedPosts + self.lockedPosts = lockedPosts + self.featuredPosts = featuredPosts + self.removedComments = removedComments + self.removedCommunities = removedCommunities + self.bannedFromCommunity = bannedFromCommunity self.banned = banned - self.added_to_community = added_to_community - self.transferred_to_community = transferred_to_community + self.addedToCommunity = addedToCommunity + self.transferredToCommunity = transferredToCommunity self.added = added - self.admin_purged_persons = admin_purged_persons - self.admin_purged_communities = admin_purged_communities - self.admin_purged_posts = admin_purged_posts - self.admin_purged_comments = admin_purged_comments - self.hidden_communities = hidden_communities + self.adminPurgedPersons = adminPurgedPersons + self.adminPurgedCommunities = adminPurgedCommunities + self.adminPurgedPosts = adminPurgedPosts + self.adminPurgedComments = adminPurgedComments + self.hiddenCommunities = hiddenCommunities } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetPersonDetails.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetPersonDetails.swift index 34d7caa..d7cca03 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetPersonDetails.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetPersonDetails.swift @@ -6,49 +6,46 @@ public struct GetPersonDetailsRequest: APIRequest { public static let httpMethod: HTTPMethod = .get public static let path: String = "/user" - public let person_id: PersonId? + public let personId: PersonId? public let username: String? public let sort: SortType? public let page: Int? public let limit: Int? - public let community_id: CommunityId? - public let saved_only: Bool? - public let auth: String? + public let communityId: CommunityId? + public let savedOnly: Bool? public init( - person_id: PersonId? = nil, + personId: PersonId? = nil, username: String? = nil, sort: SortType? = nil, page: Int? = nil, limit: Int? = nil, - community_id: CommunityId? = nil, - saved_only: Bool? = nil, - auth: String? = nil + communityId: CommunityId? = nil, + savedOnly: Bool? = nil ) { - self.person_id = person_id + self.personId = personId self.username = username self.sort = sort self.page = page self.limit = limit - self.community_id = community_id - self.saved_only = saved_only - self.auth = auth + self.communityId = communityId + self.savedOnly = savedOnly } } public struct GetPersonDetailsResponse: APIResponse { - public let person_view: PersonView + public let personView: PersonView public let comments: [CommentView] public let posts: [PostView] public let moderates: [CommunityModeratorView] public init( - person_view: PersonView, + personView: PersonView, comments: [CommentView], posts: [PostView], moderates: [CommunityModeratorView] ) { - self.person_view = person_view + self.personView = personView self.comments = comments self.posts = posts self.moderates = moderates diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetPersonMentions.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetPersonMentions.swift index 57db65a..4325825 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetPersonMentions.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetPersonMentions.swift @@ -9,21 +9,18 @@ public struct GetPersonMentionsRequest: APIRequest { public let sort: CommentSortType? public let page: Int? public let limit: Int? - public let unread_only: Bool? - public let auth: String + public let unreadOnly: Bool? public init( sort: CommentSortType? = nil, page: Int? = nil, limit: Int? = nil, - unread_only: Bool? = nil, - auth: String + unreadOnly: Bool? = nil ) { self.sort = sort self.page = page self.limit = limit - self.unread_only = unread_only - self.auth = auth + self.unreadOnly = unreadOnly } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetPost.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetPost.swift index 438f68a..930ca93 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetPost.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetPost.swift @@ -7,35 +7,32 @@ public struct GetPostRequest: APIRequest { public static let path: String = "/post" public let id: PostId? - public let comment_id: CommentId? - public let auth: String? + public let commentId: CommentId? public init( id: PostId? = nil, - comment_id: CommentId? = nil, - auth: String? = nil + commentId: CommentId? = nil ) { self.id = id - self.comment_id = comment_id - self.auth = auth + self.commentId = commentId } } public struct GetPostResponse: APIResponse { - public let post_view: PostView - public let community_view: CommunityView + public let postView: PostView + public let communityView: CommunityView public let moderators: [CommunityModeratorView] - public let cross_posts: [PostView] + public let crossPosts: [PostView] public init( - post_view: PostView, - community_view: CommunityView, + postView: PostView, + communityView: CommunityView, moderators: [CommunityModeratorView], - cross_posts: [PostView] + crossPosts: [PostView] ) { - self.post_view = post_view - self.community_view = community_view + self.postView = postView + self.communityView = communityView self.moderators = moderators - self.cross_posts = cross_posts + self.crossPosts = crossPosts } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetPosts.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetPosts.swift index f73bf90..0ed92fc 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetPosts.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetPosts.swift @@ -6,42 +6,51 @@ public struct GetPostsRequest: APIRequest { public static let httpMethod: HTTPMethod = .get public static let path: String = "/post/list" - public let type_: ListingType? + public let type: ListingType? public let sort: SortType? public let page: Int? public let limit: Int? - public let community_id: CommunityId? - public let community_name: String? - public let saved_only: Bool? - public let auth: String? + public let communityId: CommunityId? + public let communityName: String? + public let savedOnly: Bool? + public let likedOnly: Bool? + public let dislikedOnly: Bool? + public let pageCursor: PaginationCursor? public init( - type_: ListingType? = nil, + type: ListingType? = nil, sort: SortType? = nil, page: Int? = nil, limit: Int? = nil, - community_id: CommunityId? = nil, - community_name: String? = nil, - saved_only: Bool? = nil, - auth: String? = nil + communityId: CommunityId? = nil, + communityName: String? = nil, + savedOnly: Bool? = nil, + likedOnly: Bool? = nil, + dislikedOnly: Bool? = nil, + pageCursor: PaginationCursor? = nil ) { - self.type_ = type_ + self.type = type self.sort = sort self.page = page self.limit = limit - self.community_id = community_id - self.community_name = community_name - self.saved_only = saved_only - self.auth = auth + self.communityId = communityId + self.communityName = communityName + self.savedOnly = savedOnly + self.likedOnly = likedOnly + self.dislikedOnly = dislikedOnly + self.pageCursor = pageCursor } } public struct GetPostsResponse: APIResponse { public let posts: [PostView] + public let nextPage: PaginationCursor? public init( - posts: [PostView] + posts: [PostView], + nextPage: PaginationCursor? = nil ) { self.posts = posts + self.nextPage = nextPage } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetPrivateMessages.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetPrivateMessages.swift index 0335226..c544dec 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetPrivateMessages.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetPrivateMessages.swift @@ -6,30 +6,30 @@ public struct GetPrivateMessagesRequest: APIRequest { public static let httpMethod: HTTPMethod = .get public static let path: String = "/private_message/list" - public let unread_only: Bool? + public let unreadOnly: Bool? public let page: Int? public let limit: Int? - public let auth: String + public let creatorId: PersonId? public init( - unread_only: Bool? = nil, + unreadOnly: Bool? = nil, page: Int? = nil, limit: Int? = nil, - auth: String + creatorId: PersonId? = nil ) { - self.unread_only = unread_only + self.unreadOnly = unreadOnly self.page = page self.limit = limit - self.auth = auth + self.creatorId = creatorId } } public struct PrivateMessagesResponse: APIResponse { - public let private_messages: [PrivateMessageView] + public let privateMessages: [PrivateMessageView] public init( - private_messages: [PrivateMessageView] + privateMessages: [PrivateMessageView] ) { - self.private_messages = private_messages + self.privateMessages = privateMessages } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetReplies.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetReplies.swift index 7602518..9bc7e95 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetReplies.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetReplies.swift @@ -9,21 +9,18 @@ public struct GetRepliesRequest: APIRequest { public let sort: CommentSortType? public let page: Int? public let limit: Int? - public let unread_only: Bool? - public let auth: String + public let unreadOnly: Bool? public init( sort: CommentSortType? = nil, page: Int? = nil, limit: Int? = nil, - unread_only: Bool? = nil, - auth: String + unreadOnly: Bool? = nil ) { self.sort = sort self.page = page self.limit = limit - self.unread_only = unread_only - self.auth = auth + self.unreadOnly = unreadOnly } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetReportCount.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetReportCount.swift index 21e451d..301d7fb 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetReportCount.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetReportCount.swift @@ -6,33 +6,30 @@ public struct GetReportCountRequest: APIRequest { public static let httpMethod: HTTPMethod = .get public static let path: String = "/user/report_count" - public let community_id: CommunityId? - public let auth: String + public let communityId: CommunityId? public init( - community_id: CommunityId? = nil, - auth: String + communityId: CommunityId? = nil ) { - self.community_id = community_id - self.auth = auth + self.communityId = communityId } } public struct GetReportCountResponse: APIResponse { - public let community_id: CommunityId? - public let comment_reports: Int - public let post_reports: Int - public let private_message_reports: Int? + public let communityId: CommunityId? + public let commentReports: Int + public let postReports: Int + public let privateMessageReports: Int? public init( - community_id: CommunityId? = nil, - comment_reports: Int, - post_reports: Int, - private_message_reports: Int? = nil + communityId: CommunityId? = nil, + commentReports: Int, + postReports: Int, + privateMessageReports: Int? = nil ) { - self.community_id = community_id - self.comment_reports = comment_reports - self.post_reports = post_reports - self.private_message_reports = private_message_reports + self.communityId = communityId + self.commentReports = commentReports + self.postReports = postReports + self.privateMessageReports = privateMessageReports } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetSite.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetSite.swift deleted file mode 100644 index e84174b..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetSite.swift +++ /dev/null @@ -1,47 +0,0 @@ -import Foundation - -public struct GetSiteRequest: APIRequest { - public typealias Response = GetSiteResponse - - public static let httpMethod: HTTPMethod = .get - public static let path: String = "/site" - - public let auth: String? - - public init( - auth: String? = nil - ) { - self.auth = auth - } -} - -public struct GetSiteResponse: APIResponse { - public let site_view: SiteView - public let admins: [PersonView] - public let version: String - public let my_user: MyUserInfo? - public let all_languages: [Language] - public let discussion_languages: [LanguageId] - public let taglines: [Tagline] - public let custom_emojis: [CustomEmojiView] - - public init( - site_view: SiteView, - admins: [PersonView], - version: String, - my_user: MyUserInfo? = nil, - all_languages: [Language], - discussion_languages: [LanguageId], - taglines: [Tagline], - custom_emojis: [CustomEmojiView] - ) { - self.site_view = site_view - self.admins = admins - self.version = version - self.my_user = my_user - self.all_languages = all_languages - self.discussion_languages = discussion_languages - self.taglines = taglines - self.custom_emojis = custom_emojis - } -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetUnreadCount.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetUnreadCount.swift deleted file mode 100644 index acf869e..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/GetUnreadCount.swift +++ /dev/null @@ -1,32 +0,0 @@ -import Foundation - -public struct GetUnreadCountRequest: APIRequest { - public typealias Response = GetUnreadCountResponse - - public static let httpMethod: HTTPMethod = .get - public static let path: String = "/user/unread_count" - - public let auth: String - - public init( - auth: String - ) { - self.auth = auth - } -} - -public struct GetUnreadCountResponse: APIResponse { - public let replies: Int - public let mentions: Int - public let private_messages: Int - - public init( - replies: Int, - mentions: Int, - private_messages: Int - ) { - self.replies = replies - self.mentions = mentions - self.private_messages = private_messages - } -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/HideCommunity.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/HideCommunity.swift new file mode 100644 index 0000000..5850508 --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/HideCommunity.swift @@ -0,0 +1,22 @@ +import Foundation + +public struct HideCommunityRequest: APIRequest { + public typealias Response = SuccessResponse + + public static let httpMethod: HTTPMethod = .put + public static let path: String = "/community/hide" + + public let communityId: CommunityId + public let hidden: Bool + public let reason: String? + + public init( + communityId: CommunityId, + hidden: Bool, + reason: String? = nil + ) { + self.communityId = communityId + self.hidden = hidden + self.reason = reason + } +} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/LeaveAdmin.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/LeaveAdmin.swift deleted file mode 100644 index 412cdf8..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/LeaveAdmin.swift +++ /dev/null @@ -1,16 +0,0 @@ -import Foundation - -public struct LeaveAdminRequest: APIRequest { - public typealias Response = GetSiteResponse - - public static let httpMethod: HTTPMethod = .post - public static let path: String = "/user/leave_admin" - - public let auth: String - - public init( - auth: String - ) { - self.auth = auth - } -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ListCommentReports.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ListCommentReports.swift index 37be20e..7fc9695 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ListCommentReports.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ListCommentReports.swift @@ -8,31 +8,28 @@ public struct ListCommentReportsRequest: APIRequest { public let page: Int? public let limit: Int? - public let unresolved_only: Bool? - public let community_id: CommunityId? - public let auth: String + public let unresolvedOnly: Bool? + public let communityId: CommunityId? public init( page: Int? = nil, limit: Int? = nil, - unresolved_only: Bool? = nil, - community_id: CommunityId? = nil, - auth: String + unresolvedOnly: Bool? = nil, + communityId: CommunityId? = nil ) { self.page = page self.limit = limit - self.unresolved_only = unresolved_only - self.community_id = community_id - self.auth = auth + self.unresolvedOnly = unresolvedOnly + self.communityId = communityId } } public struct ListCommentReportsResponse: APIResponse { - public let comment_reports: [CommentReportView] + public let commentReports: [CommentReportView] public init( - comment_reports: [CommentReportView] + commentReports: [CommentReportView] ) { - self.comment_reports = comment_reports + self.commentReports = commentReports } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ListCommunities.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ListCommunities.swift index 49bf609..8c3c045 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ListCommunities.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ListCommunities.swift @@ -6,24 +6,24 @@ public struct ListCommunitiesRequest: APIRequest { public static let httpMethod: HTTPMethod = .get public static let path: String = "/community/list" - public let type_: ListingType? + public let type: ListingType? public let sort: SortType? + public let showNsfw: Bool? public let page: Int? public let limit: Int? - public let auth: String? public init( - type_: ListingType? = nil, + type: ListingType? = nil, sort: SortType? = nil, + showNsfw: Bool? = nil, page: Int? = nil, - limit: Int? = nil, - auth: String? = nil + limit: Int? = nil ) { - self.type_ = type_ + self.type = type self.sort = sort + self.showNsfw = showNsfw self.page = page self.limit = limit - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ListPostReports.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ListPostReports.swift index 3e85e1a..2db399a 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ListPostReports.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ListPostReports.swift @@ -8,31 +8,28 @@ public struct ListPostReportsRequest: APIRequest { public let page: Int? public let limit: Int? - public let unresolved_only: Bool? - public let community_id: CommunityId? - public let auth: String + public let unresolvedOnly: Bool? + public let communityId: CommunityId? public init( page: Int? = nil, limit: Int? = nil, - unresolved_only: Bool? = nil, - community_id: CommunityId? = nil, - auth: String + unresolvedOnly: Bool? = nil, + communityId: CommunityId? = nil ) { self.page = page self.limit = limit - self.unresolved_only = unresolved_only - self.community_id = community_id - self.auth = auth + self.unresolvedOnly = unresolvedOnly + self.communityId = communityId } } public struct ListPostReportsResponse: APIResponse { - public let post_reports: [PostReportView] + public let postReports: [PostReportView] public init( - post_reports: [PostReportView] + postReports: [PostReportView] ) { - self.post_reports = post_reports + self.postReports = postReports } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/LockPost.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/LockPost.swift index c6c4714..8eb720c 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/LockPost.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/LockPost.swift @@ -6,17 +6,14 @@ public struct LockPostRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/post/lock" - public let post_id: PostId + public let postId: PostId public let locked: Bool - public let auth: String public init( - post_id: PostId, - locked: Bool, - auth: String + postId: PostId, + locked: Bool ) { - self.post_id = post_id + self.postId = postId self.locked = locked - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/Login.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/Login.swift index 2fac1bb..a1c1bc1 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/Login.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/Login.swift @@ -6,17 +6,17 @@ public struct LoginRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/user/login" - public let username_or_email: String + public let usernameOrEmail: String public let password: String - public let totp_2fa_token: String? + public let totp_2faToken: String? public init( - username_or_email: String, + usernameOrEmail: String, password: String, - totp_2fa_token: String? = nil + totp_2faToken: String? = nil ) { - self.username_or_email = username_or_email + self.usernameOrEmail = usernameOrEmail self.password = password - self.totp_2fa_token = totp_2fa_token + self.totp_2faToken = totp_2faToken } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/MarkAllAsRead.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/MarkAllAsRead.swift deleted file mode 100644 index 1402476..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/MarkAllAsRead.swift +++ /dev/null @@ -1,16 +0,0 @@ -import Foundation - -public struct MarkAllAsReadRequest: APIRequest { - public typealias Response = GetRepliesResponse - - public static let httpMethod: HTTPMethod = .post - public static let path: String = "/user/mark_all_as_read" - - public let auth: String - - public init( - auth: String - ) { - self.auth = auth - } -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/MarkCommentReplyAsRead.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/MarkCommentReplyAsRead.swift index d0a5a25..40006ec 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/MarkCommentReplyAsRead.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/MarkCommentReplyAsRead.swift @@ -6,27 +6,24 @@ public struct MarkCommentReplyAsReadRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/comment/mark_as_read" - public let comment_reply_id: CommentReplyId + public let commentReplyId: CommentReplyId public let read: Bool - public let auth: String public init( - comment_reply_id: CommentReplyId, - read: Bool, - auth: String + commentReplyId: CommentReplyId, + read: Bool ) { - self.comment_reply_id = comment_reply_id + self.commentReplyId = commentReplyId self.read = read - self.auth = auth } } public struct CommentReplyResponse: APIResponse { - public let comment_reply_view: CommentReplyView + public let commentReplyView: CommentReplyView public init( - comment_reply_view: CommentReplyView + commentReplyView: CommentReplyView ) { - self.comment_reply_view = comment_reply_view + self.commentReplyView = commentReplyView } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/MarkPersonMentionAsRead.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/MarkPersonMentionAsRead.swift index 5ba814a..fed1a89 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/MarkPersonMentionAsRead.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/MarkPersonMentionAsRead.swift @@ -6,27 +6,24 @@ public struct MarkPersonMentionAsReadRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/user/mention/mark_as_read" - public let person_mention_id: PersonMentionId + public let personMentionId: PersonMentionId public let read: Bool - public let auth: String public init( - person_mention_id: PersonMentionId, - read: Bool, - auth: String + personMentionId: PersonMentionId, + read: Bool ) { - self.person_mention_id = person_mention_id + self.personMentionId = personMentionId self.read = read - self.auth = auth } } public struct PersonMentionResponse: APIResponse { - public let person_mention_view: PersonMentionView + public let personMentionView: PersonMentionView public init( - person_mention_view: PersonMentionView + personMentionView: PersonMentionView ) { - self.person_mention_view = person_mention_view + self.personMentionView = personMentionView } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/MarkPostAsRead.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/MarkPostAsRead.swift index 8519a30..0814897 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/MarkPostAsRead.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/MarkPostAsRead.swift @@ -1,22 +1,22 @@ import Foundation public struct MarkPostAsReadRequest: APIRequest { - public typealias Response = PostResponse + public typealias Response = SuccessResponse public static let httpMethod: HTTPMethod = .post public static let path: String = "/post/mark_as_read" - public let post_id: PostId + public let postId: PostId? + public let postIds: [PostId]? public let read: Bool - public let auth: String public init( - post_id: PostId, - read: Bool, - auth: String + postId: PostId? = nil, + postIds: [PostId]? = nil, + read: Bool ) { - self.post_id = post_id + self.postId = postId + self.postIds = postIds self.read = read - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/MarkPrivateMessageAsRead.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/MarkPrivateMessageAsRead.swift index dca8740..b4a4f82 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/MarkPrivateMessageAsRead.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/MarkPrivateMessageAsRead.swift @@ -6,17 +6,14 @@ public struct MarkPrivateMessageAsReadRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/private_message/mark_as_read" - public let private_message_id: PrivateMessageId + public let privateMessageId: PrivateMessageId public let read: Bool - public let auth: String public init( - private_message_id: PrivateMessageId, - read: Bool, - auth: String + privateMessageId: PrivateMessageId, + read: Bool ) { - self.private_message_id = private_message_id + self.privateMessageId = privateMessageId self.read = read - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PasswordChangeAfterReset.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PasswordChangeAfterReset.swift index 90127e1..d925f1f 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PasswordChangeAfterReset.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PasswordChangeAfterReset.swift @@ -1,22 +1,22 @@ import Foundation public struct PasswordChangeAfterResetRequest: APIRequest { - public typealias Response = LoginResponse + public typealias Response = SuccessResponse public static let httpMethod: HTTPMethod = .post public static let path: String = "/user/password_change" public let token: String public let password: String - public let password_verify: String + public let passwordVerify: String public init( token: String, password: String, - password_verify: String + passwordVerify: String ) { self.token = token self.password = password - self.password_verify = password_verify + self.passwordVerify = passwordVerify } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PasswordReset.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PasswordReset.swift index 3024498..1fb4061 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PasswordReset.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PasswordReset.swift @@ -1,7 +1,7 @@ import Foundation public struct PasswordResetRequest: APIRequest { - public typealias Response = PasswordResetResponse + public typealias Response = SuccessResponse public static let httpMethod: HTTPMethod = .post public static let path: String = "/user/password_reset" @@ -14,7 +14,3 @@ public struct PasswordResetRequest: APIRequest { self.email = email } } - -public struct PasswordResetResponse: APIResponse { - public init() {} -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PurgeComment.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PurgeComment.swift index 0cfe3fe..a914f8e 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PurgeComment.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PurgeComment.swift @@ -1,22 +1,19 @@ import Foundation public struct PurgeCommentRequest: APIRequest { - public typealias Response = PurgeItemResponse + public typealias Response = SuccessResponse public static let httpMethod: HTTPMethod = .post public static let path: String = "/admin/purge/comment" - public let comment_id: CommentId + public let commentId: CommentId public let reason: String? - public let auth: String public init( - comment_id: CommentId, - reason: String? = nil, - auth: String + commentId: CommentId, + reason: String? = nil ) { - self.comment_id = comment_id + self.commentId = commentId self.reason = reason - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PurgeCommunity.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PurgeCommunity.swift index 3427069..8854cb8 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PurgeCommunity.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PurgeCommunity.swift @@ -1,22 +1,19 @@ import Foundation public struct PurgeCommunityRequest: APIRequest { - public typealias Response = PurgeItemResponse + public typealias Response = SuccessResponse public static let httpMethod: HTTPMethod = .post public static let path: String = "/admin/purge/community" - public let community_id: CommunityId + public let communityId: CommunityId public let reason: String? - public let auth: String public init( - community_id: CommunityId, - reason: String? = nil, - auth: String + communityId: CommunityId, + reason: String? = nil ) { - self.community_id = community_id + self.communityId = communityId self.reason = reason - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PurgePerson.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PurgePerson.swift index 7e5933d..974ff84 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PurgePerson.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PurgePerson.swift @@ -1,32 +1,19 @@ import Foundation public struct PurgePersonRequest: APIRequest { - public typealias Response = PurgeItemResponse + public typealias Response = SuccessResponse public static let httpMethod: HTTPMethod = .post public static let path: String = "/admin/purge/person" - public let person_id: PersonId + public let personId: PersonId public let reason: String? - public let auth: String public init( - person_id: PersonId, - reason: String? = nil, - auth: String + personId: PersonId, + reason: String? = nil ) { - self.person_id = person_id + self.personId = personId self.reason = reason - self.auth = auth - } -} - -public struct PurgeItemResponse: APIResponse { - public let success: Bool - - public init( - success: Bool - ) { - self.success = success } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PurgePost.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PurgePost.swift index 0b1a72c..75f6407 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PurgePost.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/PurgePost.swift @@ -1,22 +1,19 @@ import Foundation public struct PurgePostRequest: APIRequest { - public typealias Response = PurgeItemResponse + public typealias Response = SuccessResponse public static let httpMethod: HTTPMethod = .post public static let path: String = "/admin/purge/post" - public let post_id: PostId + public let postId: PostId public let reason: String? - public let auth: String public init( - post_id: PostId, - reason: String? = nil, - auth: String + postId: PostId, + reason: String? = nil ) { - self.post_id = post_id + self.postId = postId self.reason = reason - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/Register.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/Register.swift index 451460e..21ceb99 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/Register.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/Register.swift @@ -8,32 +8,32 @@ public struct RegisterRequest: APIRequest { public let username: String public let password: String - public let password_verify: String - public let show_nsfw: Bool + public let passwordVerify: String + public let showNsfw: Bool public let email: String? - public let captcha_uuid: String? - public let captcha_answer: String? + public let captchaUuid: String? + public let captchaAnswer: String? public let honeypot: String? public let answer: String? public init( username: String, password: String, - password_verify: String, - show_nsfw: Bool, + passwordVerify: String, + showNsfw: Bool, email: String? = nil, - captcha_uuid: String? = nil, - captcha_answer: String? = nil, + captchaUuid: String? = nil, + captchaAnswer: String? = nil, honeypot: String? = nil, answer: String? = nil ) { self.username = username self.password = password - self.password_verify = password_verify - self.show_nsfw = show_nsfw + self.passwordVerify = passwordVerify + self.showNsfw = showNsfw self.email = email - self.captcha_uuid = captcha_uuid - self.captcha_answer = captcha_answer + self.captchaUuid = captchaUuid + self.captchaAnswer = captchaAnswer self.honeypot = honeypot self.answer = answer } @@ -41,16 +41,16 @@ public struct RegisterRequest: APIRequest { public struct LoginResponse: APIResponse { public let jwt: String? - public let registration_created: Bool - public let verify_email_sent: Bool + public let registrationCreated: Bool + public let verifyEmailSent: Bool public init( jwt: String? = nil, - registration_created: Bool, - verify_email_sent: Bool + registrationCreated: Bool, + verifyEmailSent: Bool ) { self.jwt = jwt - self.registration_created = registration_created - self.verify_email_sent = verify_email_sent + self.registrationCreated = registrationCreated + self.verifyEmailSent = verifyEmailSent } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/RemoveComment.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/RemoveComment.swift index 81a54de..02d99d6 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/RemoveComment.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/RemoveComment.swift @@ -6,20 +6,17 @@ public struct RemoveCommentRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/comment/remove" - public let comment_id: CommentId + public let commentId: CommentId public let removed: Bool public let reason: String? - public let auth: String public init( - comment_id: CommentId, + commentId: CommentId, removed: Bool, - reason: String? = nil, - auth: String + reason: String? = nil ) { - self.comment_id = comment_id + self.commentId = commentId self.removed = removed self.reason = reason - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/RemoveCommunity.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/RemoveCommunity.swift index 814f3a6..b8a4d08 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/RemoveCommunity.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/RemoveCommunity.swift @@ -6,23 +6,17 @@ public struct RemoveCommunityRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/community/remove" - public let community_id: CommunityId + public let communityId: CommunityId public let removed: Bool public let reason: String? - public let expires: Int? - public let auth: String public init( - community_id: CommunityId, + communityId: CommunityId, removed: Bool, - reason: String? = nil, - expires: Int? = nil, - auth: String + reason: String? = nil ) { - self.community_id = community_id + self.communityId = communityId self.removed = removed self.reason = reason - self.expires = expires - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/RemovePost.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/RemovePost.swift index b5222f1..6831be4 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/RemovePost.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/RemovePost.swift @@ -6,20 +6,17 @@ public struct RemovePostRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/post/remove" - public let post_id: PostId + public let postId: PostId public let removed: Bool public let reason: String? - public let auth: String public init( - post_id: PostId, + postId: PostId, removed: Bool, - reason: String? = nil, - auth: String + reason: String? = nil ) { - self.post_id = post_id + self.postId = postId self.removed = removed self.reason = reason - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ResolveCommentReport.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ResolveCommentReport.swift index 107101f..8a8b1ce 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ResolveCommentReport.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ResolveCommentReport.swift @@ -6,17 +6,14 @@ public struct ResolveCommentReportRequest: APIRequest { public static let httpMethod: HTTPMethod = .put public static let path: String = "/comment/report/resolve" - public let report_id: CommentReportId + public let reportId: CommentReportId public let resolved: Bool - public let auth: String public init( - report_id: CommentReportId, - resolved: Bool, - auth: String + reportId: CommentReportId, + resolved: Bool ) { - self.report_id = report_id + self.reportId = reportId self.resolved = resolved - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ResolveObject.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ResolveObject.swift index d36c00d..c9dc699 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ResolveObject.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ResolveObject.swift @@ -7,14 +7,11 @@ public struct ResolveObjectRequest: APIRequest { public static let path: String = "/resolve_object" public let q: String - public let auth: String public init( - q: String, - auth: String + q: String ) { self.q = q - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ResolvePostReport.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ResolvePostReport.swift index 960abed..3bb59d0 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ResolvePostReport.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/ResolvePostReport.swift @@ -6,17 +6,14 @@ public struct ResolvePostReportRequest: APIRequest { public static let httpMethod: HTTPMethod = .put public static let path: String = "/post/report/resolve" - public let report_id: PostReportId + public let reportId: PostReportId public let resolved: Bool - public let auth: String public init( - report_id: PostReportId, - resolved: Bool, - auth: String + reportId: PostReportId, + resolved: Bool ) { - self.report_id = report_id + self.reportId = reportId self.resolved = resolved - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/SaveComment.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/SaveComment.swift index 23bc8a6..7511e2c 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/SaveComment.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/SaveComment.swift @@ -6,17 +6,14 @@ public struct SaveCommentRequest: APIRequest { public static let httpMethod: HTTPMethod = .put public static let path: String = "/comment/save" - public let comment_id: CommentId + public let commentId: CommentId public let save: Bool - public let auth: String public init( - comment_id: CommentId, - save: Bool, - auth: String + commentId: CommentId, + save: Bool ) { - self.comment_id = comment_id + self.commentId = commentId self.save = save - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/SavePost.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/SavePost.swift index f9fca6e..1b456d6 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/SavePost.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/SavePost.swift @@ -6,17 +6,14 @@ public struct SavePostRequest: APIRequest { public static let httpMethod: HTTPMethod = .put public static let path: String = "/post/save" - public let post_id: PostId + public let postId: PostId public let save: Bool - public let auth: String public init( - post_id: PostId, - save: Bool, - auth: String + postId: PostId, + save: Bool ) { - self.post_id = post_id + self.postId = postId self.save = save - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/SaveUserSettings.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/SaveUserSettings.swift index 0e9dae1..ce1c635 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/SaveUserSettings.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/SaveUserSettings.swift @@ -1,76 +1,91 @@ import Foundation public struct SaveUserSettingsRequest: APIRequest { - public typealias Response = LoginResponse + public typealias Response = SuccessResponse public static let httpMethod: HTTPMethod = .put public static let path: String = "/user/save_user_settings" - public let show_nsfw: Bool? - public let show_scores: Bool? + public let showNsfw: Bool? + public let blurNsfw: Bool? + public let autoExpand: Bool? + public let showScores: Bool? public let theme: String? - public let default_sort_type: SortType? - public let default_listing_type: ListingType? - public let interface_language: String? + public let defaultSortType: SortType? + public let defaultListingType: ListingType? + public let interfaceLanguage: String? public let avatar: String? public let banner: String? - public let display_name: String? + public let displayName: String? public let email: String? public let bio: String? - public let matrix_user_id: String? - public let show_avatars: Bool? - public let send_notifications_to_email: Bool? - public let bot_account: Bool? - public let show_bot_accounts: Bool? - public let show_read_posts: Bool? - public let show_new_post_notifs: Bool? - public let discussion_languages: [LanguageId]? - public let generate_totp_2fa: Bool? - public let auth: String + public let matrixUserId: String? + public let showAvatars: Bool? + public let sendNotificationsToEmail: Bool? + public let botAccount: Bool? + public let showBotAccounts: Bool? + public let showReadPosts: Bool? + public let discussionLanguages: [LanguageId]? + public let openLinksInNewTab: Bool? + public let infiniteScrollEnabled: Bool? + public let postListingMode: PostListingMode? + public let enableKeyboardNavigation: Bool? + public let enableAnimatedImages: Bool? + public let collapseBotComments: Bool? public init( - show_nsfw: Bool? = nil, - show_scores: Bool? = nil, + showNsfw: Bool? = nil, + blurNsfw: Bool? = nil, + autoExpand: Bool? = nil, + showScores: Bool? = nil, theme: String? = nil, - default_sort_type: SortType? = nil, - default_listing_type: ListingType? = nil, - interface_language: String? = nil, + defaultSortType: SortType? = nil, + defaultListingType: ListingType? = nil, + interfaceLanguage: String? = nil, avatar: String? = nil, banner: String? = nil, - display_name: String? = nil, + displayName: String? = nil, email: String? = nil, bio: String? = nil, - matrix_user_id: String? = nil, - show_avatars: Bool? = nil, - send_notifications_to_email: Bool? = nil, - bot_account: Bool? = nil, - show_bot_accounts: Bool? = nil, - show_read_posts: Bool? = nil, - show_new_post_notifs: Bool? = nil, - discussion_languages: [LanguageId]? = nil, - generate_totp_2fa: Bool? = nil, - auth: String + matrixUserId: String? = nil, + showAvatars: Bool? = nil, + sendNotificationsToEmail: Bool? = nil, + botAccount: Bool? = nil, + showBotAccounts: Bool? = nil, + showReadPosts: Bool? = nil, + discussionLanguages: [LanguageId]? = nil, + openLinksInNewTab: Bool? = nil, + infiniteScrollEnabled: Bool? = nil, + postListingMode: PostListingMode? = nil, + enableKeyboardNavigation: Bool? = nil, + enableAnimatedImages: Bool? = nil, + collapseBotComments: Bool? = nil ) { - self.show_nsfw = show_nsfw - self.show_scores = show_scores + self.showNsfw = showNsfw + self.blurNsfw = blurNsfw + self.autoExpand = autoExpand + self.showScores = showScores self.theme = theme - self.default_sort_type = default_sort_type - self.default_listing_type = default_listing_type - self.interface_language = interface_language + self.defaultSortType = defaultSortType + self.defaultListingType = defaultListingType + self.interfaceLanguage = interfaceLanguage self.avatar = avatar self.banner = banner - self.display_name = display_name + self.displayName = displayName self.email = email self.bio = bio - self.matrix_user_id = matrix_user_id - self.show_avatars = show_avatars - self.send_notifications_to_email = send_notifications_to_email - self.bot_account = bot_account - self.show_bot_accounts = show_bot_accounts - self.show_read_posts = show_read_posts - self.show_new_post_notifs = show_new_post_notifs - self.discussion_languages = discussion_languages - self.generate_totp_2fa = generate_totp_2fa - self.auth = auth + self.matrixUserId = matrixUserId + self.showAvatars = showAvatars + self.sendNotificationsToEmail = sendNotificationsToEmail + self.botAccount = botAccount + self.showBotAccounts = showBotAccounts + self.showReadPosts = showReadPosts + self.discussionLanguages = discussionLanguages + self.openLinksInNewTab = openLinksInNewTab + self.infiniteScrollEnabled = infiniteScrollEnabled + self.postListingMode = postListingMode + self.enableKeyboardNavigation = enableKeyboardNavigation + self.enableAnimatedImages = enableAnimatedImages + self.collapseBotComments = collapseBotComments } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/Search.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/Search.swift index a5ca0fe..d31ce6b 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/Search.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/Search.swift @@ -7,56 +7,53 @@ public struct SearchRequest: APIRequest { public static let path: String = "/search" public let q: String - public let community_id: CommunityId? - public let community_name: String? - public let creator_id: PersonId? - public let type_: SearchType? + public let communityId: CommunityId? + public let communityName: String? + public let creatorId: PersonId? + public let type: SearchType? public let sort: SortType? - public let listing_type: ListingType? + public let listingType: ListingType? public let page: Int? public let limit: Int? - public let auth: String? public init( q: String, - community_id: CommunityId? = nil, - community_name: String? = nil, - creator_id: PersonId? = nil, - type_: SearchType? = nil, + communityId: CommunityId? = nil, + communityName: String? = nil, + creatorId: PersonId? = nil, + type: SearchType? = nil, sort: SortType? = nil, - listing_type: ListingType? = nil, + listingType: ListingType? = nil, page: Int? = nil, - limit: Int? = nil, - auth: String? = nil + limit: Int? = nil ) { self.q = q - self.community_id = community_id - self.community_name = community_name - self.creator_id = creator_id - self.type_ = type_ + self.communityId = communityId + self.communityName = communityName + self.creatorId = creatorId + self.type = type self.sort = sort - self.listing_type = listing_type + self.listingType = listingType self.page = page self.limit = limit - self.auth = auth } } public struct SearchResponse: APIResponse { - public let type_: SearchType + public let type: SearchType public let comments: [CommentView] public let posts: [PostView] public let communities: [CommunityView] public let users: [PersonView] public init( - type_: SearchType, + type: SearchType, comments: [CommentView], posts: [PostView], communities: [CommunityView], users: [PersonView] ) { - self.type_ = type_ + self.type = type self.comments = comments self.posts = posts self.communities = communities diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/TransferCommunity.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/TransferCommunity.swift index 8101f1b..22a8db8 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/TransferCommunity.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/TransferCommunity.swift @@ -6,17 +6,14 @@ public struct TransferCommunityRequest: APIRequest { public static let httpMethod: HTTPMethod = .post public static let path: String = "/community/transfer" - public let community_id: CommunityId - public let person_id: PersonId - public let auth: String + public let communityId: CommunityId + public let personId: PersonId public init( - community_id: CommunityId, - person_id: PersonId, - auth: String + communityId: CommunityId, + personId: PersonId ) { - self.community_id = community_id - self.person_id = person_id - self.auth = auth + self.communityId = communityId + self.personId = personId } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/UpdateTotp.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/UpdateTotp.swift new file mode 100644 index 0000000..9fbf119 --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/UpdateTotp.swift @@ -0,0 +1,29 @@ +import Foundation + +public struct UpdateTotpRequest: APIRequest { + public typealias Response = UpdateTotpResponse + + public static let httpMethod: HTTPMethod = .post + public static let path: String = "/user/totp/update" + + public let totpToken: String + public let enabled: Bool + + public init( + totpToken: String, + enabled: Bool + ) { + self.totpToken = totpToken + self.enabled = enabled + } +} + +public struct UpdateTotpResponse: APIResponse { + public let enabled: Bool + + public init( + enabled: Bool + ) { + self.enabled = enabled + } +} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/VerifyEmail.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/VerifyEmail.swift index 80f2f35..2b82661 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/VerifyEmail.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/VerifyEmail.swift @@ -1,7 +1,7 @@ import Foundation public struct VerifyEmailRequest: APIRequest { - public typealias Response = VerifyEmailResponse + public typealias Response = SuccessResponse public static let httpMethod: HTTPMethod = .post public static let path: String = "/user/verify_email" @@ -14,7 +14,3 @@ public struct VerifyEmailRequest: APIRequest { self.token = token } } - -public struct VerifyEmailResponse: APIResponse { - public init() {} -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Requests/any.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/any.swift new file mode 100644 index 0000000..1cac9b9 --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Requests/any.swift @@ -0,0 +1,10 @@ + +public struct SuccessResponse: APIResponse { + public let success: Bool + + public init( + success: Bool + ) { + self.success = success + } +} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgeComment.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgeComment.swift index a1e507e..05e3bd5 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgeComment.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgeComment.swift @@ -2,22 +2,22 @@ import Foundation public struct AdminPurgeComment: Codable, Identifiable, Hashable { public let id: Int - public let admin_person_id: PersonId - public let post_id: PostId + public let adminPersonId: PersonId + public let postId: PostId public let reason: String? - public let when_: String + public let when: String public init( id: Int, - admin_person_id: PersonId, - post_id: PostId, + adminPersonId: PersonId, + postId: PostId, reason: String? = nil, - when_: String + when: String ) { self.id = id - self.admin_person_id = admin_person_id - self.post_id = post_id + self.adminPersonId = adminPersonId + self.postId = postId self.reason = reason - self.when_ = when_ + self.when = when } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgeCommentView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgeCommentView.swift index d52b913..8efa00e 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgeCommentView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgeCommentView.swift @@ -1,16 +1,16 @@ import Foundation public struct AdminPurgeCommentView: Codable, Hashable { - public let admin_purge_comment: AdminPurgeComment + public let adminPurgeComment: AdminPurgeComment public let admin: Person? public let post: Post public init( - admin_purge_comment: AdminPurgeComment, + adminPurgeComment: AdminPurgeComment, admin: Person? = nil, post: Post ) { - self.admin_purge_comment = admin_purge_comment + self.adminPurgeComment = adminPurgeComment self.admin = admin self.post = post } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgeCommunity.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgeCommunity.swift index 7c75791..10b7891 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgeCommunity.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgeCommunity.swift @@ -2,19 +2,19 @@ import Foundation public struct AdminPurgeCommunity: Codable, Identifiable, Hashable { public let id: Int - public let admin_person_id: PersonId + public let adminPersonId: PersonId public let reason: String? - public let when_: String + public let when: String public init( id: Int, - admin_person_id: PersonId, + adminPersonId: PersonId, reason: String? = nil, - when_: String + when: String ) { self.id = id - self.admin_person_id = admin_person_id + self.adminPersonId = adminPersonId self.reason = reason - self.when_ = when_ + self.when = when } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgeCommunityView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgeCommunityView.swift index 0abf88b..c0958ce 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgeCommunityView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgeCommunityView.swift @@ -1,14 +1,14 @@ import Foundation public struct AdminPurgeCommunityView: Codable, Hashable { - public let admin_purge_community: AdminPurgeCommunity + public let adminPurgeCommunity: AdminPurgeCommunity public let admin: Person? public init( - admin_purge_community: AdminPurgeCommunity, + adminPurgeCommunity: AdminPurgeCommunity, admin: Person? = nil ) { - self.admin_purge_community = admin_purge_community + self.adminPurgeCommunity = adminPurgeCommunity self.admin = admin } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgePerson.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgePerson.swift index f21c6d2..87089f0 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgePerson.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgePerson.swift @@ -2,19 +2,19 @@ import Foundation public struct AdminPurgePerson: Codable, Identifiable, Hashable { public let id: Int - public let admin_person_id: PersonId + public let adminPersonId: PersonId public let reason: String? - public let when_: String + public let when: String public init( id: Int, - admin_person_id: PersonId, + adminPersonId: PersonId, reason: String? = nil, - when_: String + when: String ) { self.id = id - self.admin_person_id = admin_person_id + self.adminPersonId = adminPersonId self.reason = reason - self.when_ = when_ + self.when = when } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgePersonView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgePersonView.swift index 8ae29b3..f0ceccd 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgePersonView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgePersonView.swift @@ -1,14 +1,14 @@ import Foundation public struct AdminPurgePersonView: Codable, Hashable { - public let admin_purge_person: AdminPurgePerson + public let adminPurgePerson: AdminPurgePerson public let admin: Person? public init( - admin_purge_person: AdminPurgePerson, + adminPurgePerson: AdminPurgePerson, admin: Person? = nil ) { - self.admin_purge_person = admin_purge_person + self.adminPurgePerson = adminPurgePerson self.admin = admin } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgePost.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgePost.swift index eb9ac69..29defba 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgePost.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgePost.swift @@ -2,22 +2,22 @@ import Foundation public struct AdminPurgePost: Codable, Identifiable, Hashable { public let id: Int - public let admin_person_id: PersonId - public let community_id: CommunityId + public let adminPersonId: PersonId + public let communityId: CommunityId public let reason: String? - public let when_: String + public let when: String public init( id: Int, - admin_person_id: PersonId, - community_id: CommunityId, + adminPersonId: PersonId, + communityId: CommunityId, reason: String? = nil, - when_: String + when: String ) { self.id = id - self.admin_person_id = admin_person_id - self.community_id = community_id + self.adminPersonId = adminPersonId + self.communityId = communityId self.reason = reason - self.when_ = when_ + self.when = when } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgePostView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgePostView.swift index 5e4b23d..ccd59f0 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgePostView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgePostView.swift @@ -1,16 +1,16 @@ import Foundation public struct AdminPurgePostView: Codable, Hashable { - public let admin_purge_post: AdminPurgePost + public let adminPurgePost: AdminPurgePost public let admin: Person? public let community: Community public init( - admin_purge_post: AdminPurgePost, + adminPurgePost: AdminPurgePost, admin: Person? = nil, community: Community ) { - self.admin_purge_post = admin_purge_post + self.adminPurgePost = adminPurgePost self.admin = admin self.community = community } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ApproveRegistrationApplication.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ApproveRegistrationApplication.swift index 3113fb9..1760398 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ApproveRegistrationApplication.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ApproveRegistrationApplication.swift @@ -3,18 +3,15 @@ import Foundation public struct ApproveRegistrationApplication: Codable, Identifiable, Hashable { public let id: Int public let approve: Bool - public let deny_reason: String? - public let auth: String + public let denyReason: String? public init( id: Int, approve: Bool, - deny_reason: String? = nil, - auth: String + denyReason: String? = nil ) { self.id = id self.approve = approve - self.deny_reason = deny_reason - self.auth = auth + self.denyReason = denyReason } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/BannedPersonsResponse.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/BannedPersonsResponse.swift new file mode 100644 index 0000000..d1e394b --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/BannedPersonsResponse.swift @@ -0,0 +1,11 @@ +import Foundation + +public struct BannedPersonsResponse: Codable, Hashable { + public let banned: [PersonView] + + public init( + banned: [PersonView] + ) { + self.banned = banned + } +} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Comment.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Comment.swift index c1195b1..b503807 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Comment.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Comment.swift @@ -2,46 +2,46 @@ import Foundation public struct Comment: Codable, Identifiable, Hashable { public let id: CommentId - public let creator_id: PersonId - public let post_id: PostId + public let creatorId: PersonId + public let postId: PostId public let content: String public let removed: Bool public let published: String public let updated: String? public let deleted: Bool - public let ap_id: String + public let apId: String public let local: Bool public let path: String public let distinguished: Bool - public let language_id: LanguageId + public let languageId: LanguageId public init( id: CommentId, - creator_id: PersonId, - post_id: PostId, + creatorId: PersonId, + postId: PostId, content: String, removed: Bool, published: String, updated: String? = nil, deleted: Bool, - ap_id: String, + apId: String, local: Bool, path: String, distinguished: Bool, - language_id: LanguageId + languageId: LanguageId ) { self.id = id - self.creator_id = creator_id - self.post_id = post_id + self.creatorId = creatorId + self.postId = postId self.content = content self.removed = removed self.published = published self.updated = updated self.deleted = deleted - self.ap_id = ap_id + self.apId = apId self.local = local self.path = path self.distinguished = distinguished - self.language_id = language_id + self.languageId = languageId } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentAggregates.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentAggregates.swift index c910f04..e271eb0 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentAggregates.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentAggregates.swift @@ -1,32 +1,26 @@ import Foundation -public struct CommentAggregates: Codable, Identifiable, Hashable { - public let id: Int - public let comment_id: CommentId +public struct CommentAggregates: Codable, Hashable { + public let commentId: CommentId public let score: Int public let upvotes: Int public let downvotes: Int public let published: String - public let child_count: Int - public let hot_rank: Int + public let childCount: Int public init( - id: Int, - comment_id: CommentId, + commentId: CommentId, score: Int, upvotes: Int, downvotes: Int, published: String, - child_count: Int, - hot_rank: Int + childCount: Int ) { - self.id = id - self.comment_id = comment_id + self.commentId = commentId self.score = score self.upvotes = upvotes self.downvotes = downvotes self.published = published - self.child_count = child_count - self.hot_rank = hot_rank + self.childCount = childCount } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentReply.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentReply.swift index f921581..c5f584a 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentReply.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentReply.swift @@ -2,21 +2,21 @@ import Foundation public struct CommentReply: Codable, Identifiable, Hashable { public let id: CommentReplyId - public let recipient_id: PersonId - public let comment_id: CommentId + public let recipientId: PersonId + public let commentId: CommentId public let read: Bool public let published: String public init( id: CommentReplyId, - recipient_id: PersonId, - comment_id: CommentId, + recipientId: PersonId, + commentId: CommentId, read: Bool, published: String ) { self.id = id - self.recipient_id = recipient_id - self.comment_id = comment_id + self.recipientId = recipientId + self.commentId = commentId self.read = read self.published = published } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentReplyView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentReplyView.swift index 3fb6be6..87fa458 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentReplyView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentReplyView.swift @@ -1,44 +1,50 @@ import Foundation public struct CommentReplyView: Codable, Hashable { - public let comment_reply: CommentReply + public let commentReply: CommentReply public let comment: Comment public let creator: Person public let post: Post public let community: Community public let recipient: Person public let counts: CommentAggregates - public let creator_banned_from_community: Bool + public let creatorBannedFromCommunity: Bool + public let creatorIsModerator: Bool + public let creatorIsAdmin: Bool public let subscribed: SubscribedType public let saved: Bool - public let creator_blocked: Bool - public let my_vote: Int? + public let creatorBlocked: Bool + public let myVote: Int? public init( - comment_reply: CommentReply, + commentReply: CommentReply, comment: Comment, creator: Person, post: Post, community: Community, recipient: Person, counts: CommentAggregates, - creator_banned_from_community: Bool, + creatorBannedFromCommunity: Bool, + creatorIsModerator: Bool, + creatorIsAdmin: Bool, subscribed: SubscribedType, saved: Bool, - creator_blocked: Bool, - my_vote: Int? = nil + creatorBlocked: Bool, + myVote: Int? = nil ) { - self.comment_reply = comment_reply + self.commentReply = commentReply self.comment = comment self.creator = creator self.post = post self.community = community self.recipient = recipient self.counts = counts - self.creator_banned_from_community = creator_banned_from_community + self.creatorBannedFromCommunity = creatorBannedFromCommunity + self.creatorIsModerator = creatorIsModerator + self.creatorIsAdmin = creatorIsAdmin self.subscribed = subscribed self.saved = saved - self.creator_blocked = creator_blocked - self.my_vote = my_vote + self.creatorBlocked = creatorBlocked + self.myVote = myVote } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentReport.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentReport.swift index 7dd6297..94a3fad 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentReport.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentReport.swift @@ -2,33 +2,33 @@ import Foundation public struct CommentReport: Codable, Identifiable, Hashable { public let id: CommentReportId - public let creator_id: PersonId - public let comment_id: CommentId - public let original_comment_text: String + public let creatorId: PersonId + public let commentId: CommentId + public let originalCommentText: String public let reason: String public let resolved: Bool - public let resolver_id: PersonId? + public let resolverId: PersonId? public let published: String public let updated: String? public init( id: CommentReportId, - creator_id: PersonId, - comment_id: CommentId, - original_comment_text: String, + creatorId: PersonId, + commentId: CommentId, + originalCommentText: String, reason: String, resolved: Bool, - resolver_id: PersonId? = nil, + resolverId: PersonId? = nil, published: String, updated: String? = nil ) { self.id = id - self.creator_id = creator_id - self.comment_id = comment_id - self.original_comment_text = original_comment_text + self.creatorId = creatorId + self.commentId = commentId + self.originalCommentText = originalCommentText self.reason = reason self.resolved = resolved - self.resolver_id = resolver_id + self.resolverId = resolverId self.published = published self.updated = updated } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentReportView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentReportView.swift index 3e08051..748d37f 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentReportView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentReportView.swift @@ -1,38 +1,38 @@ import Foundation public struct CommentReportView: Codable, Hashable { - public let comment_report: CommentReport + public let commentReport: CommentReport public let comment: Comment public let post: Post public let community: Community public let creator: Person - public let comment_creator: Person + public let commentCreator: Person public let counts: CommentAggregates - public let creator_banned_from_community: Bool - public let my_vote: Int? + public let creatorBannedFromCommunity: Bool + public let myVote: Int? public let resolver: Person? public init( - comment_report: CommentReport, + commentReport: CommentReport, comment: Comment, post: Post, community: Community, creator: Person, - comment_creator: Person, + commentCreator: Person, counts: CommentAggregates, - creator_banned_from_community: Bool, - my_vote: Int? = nil, + creatorBannedFromCommunity: Bool, + myVote: Int? = nil, resolver: Person? = nil ) { - self.comment_report = comment_report + self.commentReport = commentReport self.comment = comment self.post = post self.community = community self.creator = creator - self.comment_creator = comment_creator + self.commentCreator = commentCreator self.counts = counts - self.creator_banned_from_community = creator_banned_from_community - self.my_vote = my_vote + self.creatorBannedFromCommunity = creatorBannedFromCommunity + self.myVote = myVote self.resolver = resolver } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentView.swift index 51f549b..6fd3ed5 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentView.swift @@ -6,11 +6,13 @@ public struct CommentView: Codable, Hashable { public let post: Post public let community: Community public let counts: CommentAggregates - public let creator_banned_from_community: Bool + public let creatorBannedFromCommunity: Bool + public let creatorIsModerator: Bool + public let creatorIsAdmin: Bool public let subscribed: SubscribedType public let saved: Bool - public let creator_blocked: Bool - public let my_vote: Int? + public let creatorBlocked: Bool + public let myVote: Int? public init( comment: Comment, @@ -18,21 +20,25 @@ public struct CommentView: Codable, Hashable { post: Post, community: Community, counts: CommentAggregates, - creator_banned_from_community: Bool, + creatorBannedFromCommunity: Bool, + creatorIsModerator: Bool, + creatorIsAdmin: Bool, subscribed: SubscribedType, saved: Bool, - creator_blocked: Bool, - my_vote: Int? = nil + creatorBlocked: Bool, + myVote: Int? = nil ) { self.comment = comment self.creator = creator self.post = post self.community = community self.counts = counts - self.creator_banned_from_community = creator_banned_from_community + self.creatorBannedFromCommunity = creatorBannedFromCommunity + self.creatorIsModerator = creatorIsModerator + self.creatorIsAdmin = creatorIsAdmin self.subscribed = subscribed self.saved = saved - self.creator_blocked = creator_blocked - self.my_vote = my_vote + self.creatorBlocked = creatorBlocked + self.myVote = myVote } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Community.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Community.swift index 9756d9e..0f86540 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Community.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Community.swift @@ -10,13 +10,13 @@ public struct Community: Codable, Identifiable, Hashable { public let updated: String? public let deleted: Bool public let nsfw: Bool - public let actor_id: String + public let actorId: String public let local: Bool public let icon: String? public let banner: String? public let hidden: Bool - public let posting_restricted_to_mods: Bool - public let instance_id: InstanceId + public let postingRestrictedToMods: Bool + public let instanceId: InstanceId public init( id: CommunityId, @@ -28,13 +28,13 @@ public struct Community: Codable, Identifiable, Hashable { updated: String? = nil, deleted: Bool, nsfw: Bool, - actor_id: String, + actorId: String, local: Bool, icon: String? = nil, banner: String? = nil, hidden: Bool, - posting_restricted_to_mods: Bool, - instance_id: InstanceId + postingRestrictedToMods: Bool, + instanceId: InstanceId ) { self.id = id self.name = name @@ -45,12 +45,12 @@ public struct Community: Codable, Identifiable, Hashable { self.updated = updated self.deleted = deleted self.nsfw = nsfw - self.actor_id = actor_id + self.actorId = actorId self.local = local self.icon = icon self.banner = banner self.hidden = hidden - self.posting_restricted_to_mods = posting_restricted_to_mods - self.instance_id = instance_id + self.postingRestrictedToMods = postingRestrictedToMods + self.instanceId = instanceId } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommunityAggregates.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommunityAggregates.swift index 7c7b1c4..e4ac574 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommunityAggregates.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommunityAggregates.swift @@ -1,41 +1,35 @@ import Foundation -public struct CommunityAggregates: Codable, Identifiable, Hashable { - public let id: Int - public let community_id: CommunityId +public struct CommunityAggregates: Codable, Hashable { + public let communityId: CommunityId public let subscribers: Int public let posts: Int public let comments: Int public let published: String - public let users_active_day: Int - public let users_active_week: Int - public let users_active_month: Int - public let users_active_half_year: Int - public let hot_rank: Int + public let usersActiveDay: Int + public let usersActiveWeek: Int + public let usersActiveMonth: Int + public let usersActiveHalfYear: Int public init( - id: Int, - community_id: CommunityId, + communityId: CommunityId, subscribers: Int, posts: Int, comments: Int, published: String, - users_active_day: Int, - users_active_week: Int, - users_active_month: Int, - users_active_half_year: Int, - hot_rank: Int + usersActiveDay: Int, + usersActiveWeek: Int, + usersActiveMonth: Int, + usersActiveHalfYear: Int ) { - self.id = id - self.community_id = community_id + self.communityId = communityId self.subscribers = subscribers self.posts = posts self.comments = comments self.published = published - self.users_active_day = users_active_day - self.users_active_week = users_active_week - self.users_active_month = users_active_month - self.users_active_half_year = users_active_half_year - self.hot_rank = hot_rank + self.usersActiveDay = usersActiveDay + self.usersActiveWeek = usersActiveWeek + self.usersActiveMonth = usersActiveMonth + self.usersActiveHalfYear = usersActiveHalfYear } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommunityJoin.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommunityJoin.swift deleted file mode 100644 index 6997585..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommunityJoin.swift +++ /dev/null @@ -1,11 +0,0 @@ -import Foundation - -public struct CommunityJoin: Codable, Hashable { - public let community_id: CommunityId - - public init( - community_id: CommunityId - ) { - self.community_id = community_id - } -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommunityJoinResponse.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommunityJoinResponse.swift deleted file mode 100644 index 06d52d1..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommunityJoinResponse.swift +++ /dev/null @@ -1,11 +0,0 @@ -import Foundation - -public struct CommunityJoinResponse: Codable, Hashable { - public let joined: Bool - - public init( - joined: Bool - ) { - self.joined = joined - } -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CreatePrivateMessageReport.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CreatePrivateMessageReport.swift index f13f82c..24fadaf 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CreatePrivateMessageReport.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CreatePrivateMessageReport.swift @@ -1,17 +1,14 @@ import Foundation public struct CreatePrivateMessageReport: Codable, Hashable { - public let private_message_id: PrivateMessageId + public let privateMessageId: PrivateMessageId public let reason: String - public let auth: String public init( - private_message_id: PrivateMessageId, - reason: String, - auth: String + privateMessageId: PrivateMessageId, + reason: String ) { - self.private_message_id = private_message_id + self.privateMessageId = privateMessageId self.reason = reason - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CustomEmoji.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CustomEmoji.swift index e0ee0cf..46e4bfd 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CustomEmoji.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CustomEmoji.swift @@ -2,29 +2,29 @@ import Foundation public struct CustomEmoji: Codable, Identifiable, Hashable { public let id: CustomEmojiId - public let local_site_id: LocalSiteId + public let localSiteId: LocalSiteId public let shortcode: String - public let image_url: String - public let alt_text: String + public let imageUrl: String + public let altText: String public let category: String public let published: String public let updated: String? public init( id: CustomEmojiId, - local_site_id: LocalSiteId, + localSiteId: LocalSiteId, shortcode: String, - image_url: String, - alt_text: String, + imageUrl: String, + altText: String, category: String, published: String, updated: String? = nil ) { self.id = id - self.local_site_id = local_site_id + self.localSiteId = localSiteId self.shortcode = shortcode - self.image_url = image_url - self.alt_text = alt_text + self.imageUrl = imageUrl + self.altText = altText self.category = category self.published = published self.updated = updated diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CustomEmojiKeyword.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CustomEmojiKeyword.swift index 37f5b0f..238c47d 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CustomEmojiKeyword.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CustomEmojiKeyword.swift @@ -1,17 +1,14 @@ import Foundation -public struct CustomEmojiKeyword: Codable, Identifiable, Hashable { - public let id: Int - public let custom_emoji_id: CustomEmojiId +public struct CustomEmojiKeyword: Codable, Hashable { + public let customEmojiId: CustomEmojiId public let keyword: String public init( - id: Int, - custom_emoji_id: CustomEmojiId, + customEmojiId: CustomEmojiId, keyword: String ) { - self.id = id - self.custom_emoji_id = custom_emoji_id + self.customEmojiId = customEmojiId self.keyword = keyword } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CustomEmojiView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CustomEmojiView.swift index 52e9389..e4725fc 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CustomEmojiView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/CustomEmojiView.swift @@ -1,14 +1,14 @@ import Foundation public struct CustomEmojiView: Codable, Hashable { - public let custom_emoji: CustomEmoji + public let customEmoji: CustomEmoji public let keywords: [CustomEmojiKeyword] public init( - custom_emoji: CustomEmoji, + customEmoji: CustomEmoji, keywords: [CustomEmojiKeyword] ) { - self.custom_emoji = custom_emoji + self.customEmoji = customEmoji self.keywords = keywords } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/FederatedInstances.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/FederatedInstances.swift index e6d6fb3..238de19 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/FederatedInstances.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/FederatedInstances.swift @@ -1,14 +1,14 @@ import Foundation public struct FederatedInstances: Codable, Hashable { - public let linked: [Instance] - public let allowed: [Instance] - public let blocked: [Instance] + public let linked: [InstanceWithFederationState] + public let allowed: [InstanceWithFederationState] + public let blocked: [InstanceWithFederationState] public init( - linked: [Instance], - allowed: [Instance], - blocked: [Instance] + linked: [InstanceWithFederationState], + allowed: [InstanceWithFederationState], + blocked: [InstanceWithFederationState] ) { self.linked = linked self.allowed = allowed diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GenerateTotpSecretResponse.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GenerateTotpSecretResponse.swift new file mode 100644 index 0000000..311dd88 --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GenerateTotpSecretResponse.swift @@ -0,0 +1,11 @@ +import Foundation + +public struct GenerateTotpSecretResponse: Codable, Hashable { + public let totpSecretUrl: String + + public init( + totpSecretUrl: String + ) { + self.totpSecretUrl = totpSecretUrl + } +} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetCaptcha.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetCaptcha.swift new file mode 100644 index 0000000..4cca149 --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetCaptcha.swift @@ -0,0 +1,11 @@ +import Foundation + +public struct GetCaptcha: Codable, Hashable { + public let auth: String? + + public init( + auth: String? = nil + ) { + self.auth = auth + } +} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetCaptchaResponse.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetCaptchaResponse.swift new file mode 100644 index 0000000..5d1e0fa --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetCaptchaResponse.swift @@ -0,0 +1,11 @@ +import Foundation + +public struct GetCaptchaResponse: Codable, Hashable { + public let ok: CaptchaResponse? + + public init( + ok: CaptchaResponse? = nil + ) { + self.ok = ok + } +} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetSite.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetSite.swift new file mode 100644 index 0000000..18f2aa7 --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetSite.swift @@ -0,0 +1,11 @@ +import Foundation + +public struct GetSite: Codable, Hashable { + public let auth: String? + + public init( + auth: String? = nil + ) { + self.auth = auth + } +} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetSiteResponse.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetSiteResponse.swift new file mode 100644 index 0000000..856e601 --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetSiteResponse.swift @@ -0,0 +1,32 @@ +import Foundation + +public struct GetSiteResponse: Codable, Hashable { + public let siteView: SiteView + public let admins: [PersonView] + public let version: String + public let myUser: MyUserInfo? + public let allLanguages: [Language] + public let discussionLanguages: [LanguageId] + public let taglines: [Tagline] + public let customEmojis: [CustomEmojiView] + + public init( + siteView: SiteView, + admins: [PersonView], + version: String, + myUser: MyUserInfo? = nil, + allLanguages: [Language], + discussionLanguages: [LanguageId], + taglines: [Tagline], + customEmojis: [CustomEmojiView] + ) { + self.siteView = siteView + self.admins = admins + self.version = version + self.myUser = myUser + self.allLanguages = allLanguages + self.discussionLanguages = discussionLanguages + self.taglines = taglines + self.customEmojis = customEmojis + } +} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/UserJoin.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetUnreadCount.swift similarity index 67% rename from Sources/Lemmy-Swift-Client/Lemmy API/Structs/UserJoin.swift rename to Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetUnreadCount.swift index d5cbe36..70a2fe1 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/UserJoin.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetUnreadCount.swift @@ -1,6 +1,6 @@ import Foundation -public struct UserJoin: Codable, Hashable { +public struct GetUnreadCount: Codable, Hashable { public let auth: String public init( diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetUnreadCountResponse.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetUnreadCountResponse.swift new file mode 100644 index 0000000..e2da42d --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetUnreadCountResponse.swift @@ -0,0 +1,17 @@ +import Foundation + +public struct GetUnreadCountResponse: Codable, Hashable { + public let replies: Int + public let mentions: Int + public let privateMessages: Int + + public init( + replies: Int, + mentions: Int, + privateMessages: Int + ) { + self.replies = replies + self.mentions = mentions + self.privateMessages = privateMessages + } +} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetUnreadRegistrationApplicationCount.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetUnreadRegistrationApplicationCount.swift deleted file mode 100644 index 2ce3c46..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetUnreadRegistrationApplicationCount.swift +++ /dev/null @@ -1,11 +0,0 @@ -import Foundation - -public struct GetUnreadRegistrationApplicationCount: Codable, Hashable { - public let auth: String - - public init( - auth: String - ) { - self.auth = auth - } -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetUnreadRegistrationApplicationCountResponse.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetUnreadRegistrationApplicationCountResponse.swift index 5f0352c..d590478 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetUnreadRegistrationApplicationCountResponse.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/GetUnreadRegistrationApplicationCountResponse.swift @@ -1,11 +1,11 @@ import Foundation public struct GetUnreadRegistrationApplicationCountResponse: Codable, Hashable { - public let registration_applications: Int + public let registrationApplications: Int public init( - registration_applications: Int + registrationApplications: Int ) { - self.registration_applications = registration_applications + self.registrationApplications = registrationApplications } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/HideCommunity.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/HideCommunity.swift deleted file mode 100644 index 5b755a6..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/HideCommunity.swift +++ /dev/null @@ -1,20 +0,0 @@ -import Foundation - -public struct HideCommunity: Codable, Hashable { - public let community_id: CommunityId - public let hidden: Bool - public let reason: String? - public let auth: String - - public init( - community_id: CommunityId, - hidden: Bool, - reason: String? = nil, - auth: String - ) { - self.community_id = community_id - self.hidden = hidden - self.reason = reason - self.auth = auth - } -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ImageUpload.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ImageUpload.swift new file mode 100644 index 0000000..6badce1 --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ImageUpload.swift @@ -0,0 +1,20 @@ +import Foundation + +public struct ImageUpload: Codable, Hashable { + public let localUserId: LocalUserId + public let pictrsAlias: String + public let pictrsDeleteToken: String + public let published: String + + public init( + localUserId: LocalUserId, + pictrsAlias: String, + pictrsDeleteToken: String, + published: String + ) { + self.localUserId = localUserId + self.pictrsAlias = pictrsAlias + self.pictrsDeleteToken = pictrsDeleteToken + self.published = published + } +} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/InstanceBlockView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/InstanceBlockView.swift new file mode 100644 index 0000000..f421949 --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/InstanceBlockView.swift @@ -0,0 +1,17 @@ +import Foundation + +public struct InstanceBlockView: Codable, Hashable { + public let person: Person + public let instance: Instance + public let site: Site? + + public init( + person: Person, + instance: Instance, + site: Site? = nil + ) { + self.person = person + self.instance = instance + self.site = site + } +} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/InstanceWithFederationState.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/InstanceWithFederationState.swift new file mode 100644 index 0000000..9220bd4 --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/InstanceWithFederationState.swift @@ -0,0 +1,29 @@ +import Foundation + +public struct InstanceWithFederationState: Codable, Identifiable, Hashable { + public let id: InstanceId + public let domain: String + public let published: String + public let updated: String? + public let software: String? + public let version: String? + public let federationState: ReadableFederationState? + + public init( + id: InstanceId, + domain: String, + published: String, + updated: String? = nil, + software: String? = nil, + version: String? = nil, + federationState: ReadableFederationState? = nil + ) { + self.id = id + self.domain = domain + self.published = published + self.updated = updated + self.software = software + self.version = version + self.federationState = federationState + } +} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListPrivateMessageReports.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListPrivateMessageReports.swift index 626f1c1..31d0e2e 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListPrivateMessageReports.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListPrivateMessageReports.swift @@ -3,18 +3,15 @@ import Foundation public struct ListPrivateMessageReports: Codable, Hashable { public let page: Int? public let limit: Int? - public let unresolved_only: Bool? - public let auth: String + public let unresolvedOnly: Bool? public init( page: Int? = nil, limit: Int? = nil, - unresolved_only: Bool? = nil, - auth: String + unresolvedOnly: Bool? = nil ) { self.page = page self.limit = limit - self.unresolved_only = unresolved_only - self.auth = auth + self.unresolvedOnly = unresolvedOnly } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListPrivateMessageReportsResponse.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListPrivateMessageReportsResponse.swift index 3b5b8be..ed3901b 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListPrivateMessageReportsResponse.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListPrivateMessageReportsResponse.swift @@ -1,11 +1,11 @@ import Foundation public struct ListPrivateMessageReportsResponse: Codable, Hashable { - public let private_message_reports: [PrivateMessageReportView] + public let privateMessageReports: [PrivateMessageReportView] public init( - private_message_reports: [PrivateMessageReportView] + privateMessageReports: [PrivateMessageReportView] ) { - self.private_message_reports = private_message_reports + self.privateMessageReports = privateMessageReports } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListRegistrationApplications.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListRegistrationApplications.swift index 773c919..41c8c60 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListRegistrationApplications.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListRegistrationApplications.swift @@ -1,20 +1,17 @@ import Foundation public struct ListRegistrationApplications: Codable, Hashable { - public let unread_only: Bool? + public let unreadOnly: Bool? public let page: Int? public let limit: Int? - public let auth: String public init( - unread_only: Bool? = nil, + unreadOnly: Bool? = nil, page: Int? = nil, - limit: Int? = nil, - auth: String + limit: Int? = nil ) { - self.unread_only = unread_only + self.unreadOnly = unreadOnly self.page = page self.limit = limit - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListRegistrationApplicationsResponse.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListRegistrationApplicationsResponse.swift index b564cdf..97ee235 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListRegistrationApplicationsResponse.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ListRegistrationApplicationsResponse.swift @@ -1,11 +1,11 @@ import Foundation public struct ListRegistrationApplicationsResponse: Codable, Hashable { - public let registration_applications: [RegistrationApplicationView] + public let registrationApplications: [RegistrationApplicationView] public init( - registration_applications: [RegistrationApplicationView] + registrationApplications: [RegistrationApplicationView] ) { - self.registration_applications = registration_applications + self.registrationApplications = registrationApplications } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/LocalSite.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/LocalSite.swift index 4491e08..660e07b 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/LocalSite.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/LocalSite.swift @@ -2,76 +2,79 @@ import Foundation public struct LocalSite: Codable, Identifiable, Hashable { public let id: LocalSiteId - public let site_id: SiteId - public let site_setup: Bool - public let enable_downvotes: Bool - public let enable_nsfw: Bool - public let community_creation_admin_only: Bool - public let require_email_verification: Bool - public let application_question: String? - public let private_instance: Bool - public let default_theme: String - public let default_post_listing_type: ListingType - public let legal_information: String? - public let hide_modlog_mod_names: Bool - public let application_email_admins: Bool - public let slur_filter_regex: String? - public let actor_name_max_length: Int - public let federation_enabled: Bool - public let captcha_enabled: Bool - public let captcha_difficulty: String + public let siteId: SiteId + public let siteSetup: Bool + public let enableDownvotes: Bool + public let enableNsfw: Bool + public let communityCreationAdminOnly: Bool + public let requireEmailVerification: Bool + public let applicationQuestion: String? + public let privateInstance: Bool + public let defaultTheme: String + public let defaultPostListingType: ListingType + public let legalInformation: String? + public let hideModlogModNames: Bool + public let applicationEmailAdmins: Bool + public let slurFilterRegex: String? + public let actorNameMaxLength: Int + public let federationEnabled: Bool + public let captchaEnabled: Bool + public let captchaDifficulty: String public let published: String public let updated: String? - public let registration_mode: RegistrationMode - public let reports_email_admins: Bool + public let registrationMode: RegistrationMode + public let reportsEmailAdmins: Bool + public let federationSignedFetch: Bool public init( id: LocalSiteId, - site_id: SiteId, - site_setup: Bool, - enable_downvotes: Bool, - enable_nsfw: Bool, - community_creation_admin_only: Bool, - require_email_verification: Bool, - application_question: String? = nil, - private_instance: Bool, - default_theme: String, - default_post_listing_type: ListingType, - legal_information: String? = nil, - hide_modlog_mod_names: Bool, - application_email_admins: Bool, - slur_filter_regex: String? = nil, - actor_name_max_length: Int, - federation_enabled: Bool, - captcha_enabled: Bool, - captcha_difficulty: String, + siteId: SiteId, + siteSetup: Bool, + enableDownvotes: Bool, + enableNsfw: Bool, + communityCreationAdminOnly: Bool, + requireEmailVerification: Bool, + applicationQuestion: String? = nil, + privateInstance: Bool, + defaultTheme: String, + defaultPostListingType: ListingType, + legalInformation: String? = nil, + hideModlogModNames: Bool, + applicationEmailAdmins: Bool, + slurFilterRegex: String? = nil, + actorNameMaxLength: Int, + federationEnabled: Bool, + captchaEnabled: Bool, + captchaDifficulty: String, published: String, updated: String? = nil, - registration_mode: RegistrationMode, - reports_email_admins: Bool + registrationMode: RegistrationMode, + reportsEmailAdmins: Bool, + federationSignedFetch: Bool ) { self.id = id - self.site_id = site_id - self.site_setup = site_setup - self.enable_downvotes = enable_downvotes - self.enable_nsfw = enable_nsfw - self.community_creation_admin_only = community_creation_admin_only - self.require_email_verification = require_email_verification - self.application_question = application_question - self.private_instance = private_instance - self.default_theme = default_theme - self.default_post_listing_type = default_post_listing_type - self.legal_information = legal_information - self.hide_modlog_mod_names = hide_modlog_mod_names - self.application_email_admins = application_email_admins - self.slur_filter_regex = slur_filter_regex - self.actor_name_max_length = actor_name_max_length - self.federation_enabled = federation_enabled - self.captcha_enabled = captcha_enabled - self.captcha_difficulty = captcha_difficulty + self.siteId = siteId + self.siteSetup = siteSetup + self.enableDownvotes = enableDownvotes + self.enableNsfw = enableNsfw + self.communityCreationAdminOnly = communityCreationAdminOnly + self.requireEmailVerification = requireEmailVerification + self.applicationQuestion = applicationQuestion + self.privateInstance = privateInstance + self.defaultTheme = defaultTheme + self.defaultPostListingType = defaultPostListingType + self.legalInformation = legalInformation + self.hideModlogModNames = hideModlogModNames + self.applicationEmailAdmins = applicationEmailAdmins + self.slurFilterRegex = slurFilterRegex + self.actorNameMaxLength = actorNameMaxLength + self.federationEnabled = federationEnabled + self.captchaEnabled = captchaEnabled + self.captchaDifficulty = captchaDifficulty self.published = published self.updated = updated - self.registration_mode = registration_mode - self.reports_email_admins = reports_email_admins + self.registrationMode = registrationMode + self.reportsEmailAdmins = reportsEmailAdmins + self.federationSignedFetch = federationSignedFetch } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/LocalSiteRateLimit.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/LocalSiteRateLimit.swift index ec1a7e8..17cfb03 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/LocalSiteRateLimit.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/LocalSiteRateLimit.swift @@ -1,56 +1,59 @@ import Foundation -public struct LocalSiteRateLimit: Codable, Identifiable, Hashable { - public let id: Int - public let local_site_id: LocalSiteId +public struct LocalSiteRateLimit: Codable, Hashable { + public let localSiteId: LocalSiteId public let message: Int - public let message_per_second: Int + public let messagePerSecond: Int public let post: Int - public let post_per_second: Int + public let postPerSecond: Int public let register: Int - public let register_per_second: Int + public let registerPerSecond: Int public let image: Int - public let image_per_second: Int + public let imagePerSecond: Int public let comment: Int - public let comment_per_second: Int + public let commentPerSecond: Int public let search: Int - public let search_per_second: Int + public let searchPerSecond: Int public let published: String public let updated: String? + public let importUserSettings: Int + public let importUserSettingsPerSecond: Int public init( - id: Int, - local_site_id: LocalSiteId, + localSiteId: LocalSiteId, message: Int, - message_per_second: Int, + messagePerSecond: Int, post: Int, - post_per_second: Int, + postPerSecond: Int, register: Int, - register_per_second: Int, + registerPerSecond: Int, image: Int, - image_per_second: Int, + imagePerSecond: Int, comment: Int, - comment_per_second: Int, + commentPerSecond: Int, search: Int, - search_per_second: Int, + searchPerSecond: Int, published: String, - updated: String? = nil + updated: String? = nil, + importUserSettings: Int, + importUserSettingsPerSecond: Int ) { - self.id = id - self.local_site_id = local_site_id + self.localSiteId = localSiteId self.message = message - self.message_per_second = message_per_second + self.messagePerSecond = messagePerSecond self.post = post - self.post_per_second = post_per_second + self.postPerSecond = postPerSecond self.register = register - self.register_per_second = register_per_second + self.registerPerSecond = registerPerSecond self.image = image - self.image_per_second = image_per_second + self.imagePerSecond = imagePerSecond self.comment = comment - self.comment_per_second = comment_per_second + self.commentPerSecond = commentPerSecond self.search = search - self.search_per_second = search_per_second + self.searchPerSecond = searchPerSecond self.published = published self.updated = updated + self.importUserSettings = importUserSettings + self.importUserSettingsPerSecond = importUserSettingsPerSecond } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/LocalUser.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/LocalUser.swift index 46e73c0..0f522f2 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/LocalUser.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/LocalUser.swift @@ -2,61 +2,82 @@ import Foundation public struct LocalUser: Codable, Identifiable, Hashable { public let id: LocalUserId - public let person_id: PersonId + public let personId: PersonId public let email: String? - public let show_nsfw: Bool + public let showNsfw: Bool public let theme: String - public let default_sort_type: SortType - public let default_listing_type: ListingType - public let interface_language: String - public let show_avatars: Bool - public let send_notifications_to_email: Bool - public let validator_time: String - public let show_scores: Bool - public let show_bot_accounts: Bool - public let show_read_posts: Bool - public let show_new_post_notifs: Bool - public let email_verified: Bool - public let accepted_application: Bool - public let totp_2fa_url: String? + public let defaultSortType: SortType + public let defaultListingType: ListingType + public let interfaceLanguage: String + public let showAvatars: Bool + public let sendNotificationsToEmail: Bool + public let showScores: Bool + public let showBotAccounts: Bool + public let showReadPosts: Bool + public let emailVerified: Bool + public let acceptedApplication: Bool + public let openLinksInNewTab: Bool + public let blurNsfw: Bool + public let autoExpand: Bool + public let infiniteScrollEnabled: Bool + public let admin: Bool + public let postListingMode: PostListingMode + public let totp_2faEnabled: Bool + public let enableKeyboardNavigation: Bool + public let enableAnimatedImages: Bool + public let collapseBotComments: Bool public init( id: LocalUserId, - person_id: PersonId, + personId: PersonId, email: String? = nil, - show_nsfw: Bool, + showNsfw: Bool, theme: String, - default_sort_type: SortType, - default_listing_type: ListingType, - interface_language: String, - show_avatars: Bool, - send_notifications_to_email: Bool, - validator_time: String, - show_scores: Bool, - show_bot_accounts: Bool, - show_read_posts: Bool, - show_new_post_notifs: Bool, - email_verified: Bool, - accepted_application: Bool, - totp_2fa_url: String? = nil + defaultSortType: SortType, + defaultListingType: ListingType, + interfaceLanguage: String, + showAvatars: Bool, + sendNotificationsToEmail: Bool, + showScores: Bool, + showBotAccounts: Bool, + showReadPosts: Bool, + emailVerified: Bool, + acceptedApplication: Bool, + openLinksInNewTab: Bool, + blurNsfw: Bool, + autoExpand: Bool, + infiniteScrollEnabled: Bool, + admin: Bool, + postListingMode: PostListingMode, + totp_2faEnabled: Bool, + enableKeyboardNavigation: Bool, + enableAnimatedImages: Bool, + collapseBotComments: Bool ) { self.id = id - self.person_id = person_id + self.personId = personId self.email = email - self.show_nsfw = show_nsfw + self.showNsfw = showNsfw self.theme = theme - self.default_sort_type = default_sort_type - self.default_listing_type = default_listing_type - self.interface_language = interface_language - self.show_avatars = show_avatars - self.send_notifications_to_email = send_notifications_to_email - self.validator_time = validator_time - self.show_scores = show_scores - self.show_bot_accounts = show_bot_accounts - self.show_read_posts = show_read_posts - self.show_new_post_notifs = show_new_post_notifs - self.email_verified = email_verified - self.accepted_application = accepted_application - self.totp_2fa_url = totp_2fa_url + self.defaultSortType = defaultSortType + self.defaultListingType = defaultListingType + self.interfaceLanguage = interfaceLanguage + self.showAvatars = showAvatars + self.sendNotificationsToEmail = sendNotificationsToEmail + self.showScores = showScores + self.showBotAccounts = showBotAccounts + self.showReadPosts = showReadPosts + self.emailVerified = emailVerified + self.acceptedApplication = acceptedApplication + self.openLinksInNewTab = openLinksInNewTab + self.blurNsfw = blurNsfw + self.autoExpand = autoExpand + self.infiniteScrollEnabled = infiniteScrollEnabled + self.admin = admin + self.postListingMode = postListingMode + self.totp_2faEnabled = totp_2faEnabled + self.enableKeyboardNavigation = enableKeyboardNavigation + self.enableAnimatedImages = enableAnimatedImages + self.collapseBotComments = collapseBotComments } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/LocalUserView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/LocalUserView.swift index 5f3b032..1df4cab 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/LocalUserView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/LocalUserView.swift @@ -1,16 +1,16 @@ import Foundation public struct LocalUserView: Codable, Hashable { - public let local_user: LocalUser + public let localUser: LocalUser public let person: Person public let counts: PersonAggregates public init( - local_user: LocalUser, + localUser: LocalUser, person: Person, counts: PersonAggregates ) { - self.local_user = local_user + self.localUser = localUser self.person = person self.counts = counts } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/LoginToken.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/LoginToken.swift new file mode 100644 index 0000000..308a606 --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/LoginToken.swift @@ -0,0 +1,20 @@ +import Foundation + +public struct LoginToken: Codable, Hashable { + public let userId: LocalUserId + public let published: String + public let ip: String? + public let userAgent: String? + + public init( + userId: LocalUserId, + published: String, + ip: String? = nil, + userAgent: String? = nil + ) { + self.userId = userId + self.published = published + self.ip = ip + self.userAgent = userAgent + } +} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModAdd.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModAdd.swift index ae42bbc..806afa5 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModAdd.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModAdd.swift @@ -2,22 +2,22 @@ import Foundation public struct ModAdd: Codable, Identifiable, Hashable { public let id: Int - public let mod_person_id: PersonId - public let other_person_id: PersonId + public let modPersonId: PersonId + public let otherPersonId: PersonId public let removed: Bool - public let when_: String + public let when: String public init( id: Int, - mod_person_id: PersonId, - other_person_id: PersonId, + modPersonId: PersonId, + otherPersonId: PersonId, removed: Bool, - when_: String + when: String ) { self.id = id - self.mod_person_id = mod_person_id - self.other_person_id = other_person_id + self.modPersonId = modPersonId + self.otherPersonId = otherPersonId self.removed = removed - self.when_ = when_ + self.when = when } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModAddCommunity.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModAddCommunity.swift index 84c7591..3bbde7e 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModAddCommunity.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModAddCommunity.swift @@ -2,25 +2,25 @@ import Foundation public struct ModAddCommunity: Codable, Identifiable, Hashable { public let id: Int - public let mod_person_id: PersonId - public let other_person_id: PersonId - public let community_id: CommunityId + public let modPersonId: PersonId + public let otherPersonId: PersonId + public let communityId: CommunityId public let removed: Bool - public let when_: String + public let when: String public init( id: Int, - mod_person_id: PersonId, - other_person_id: PersonId, - community_id: CommunityId, + modPersonId: PersonId, + otherPersonId: PersonId, + communityId: CommunityId, removed: Bool, - when_: String + when: String ) { self.id = id - self.mod_person_id = mod_person_id - self.other_person_id = other_person_id - self.community_id = community_id + self.modPersonId = modPersonId + self.otherPersonId = otherPersonId + self.communityId = communityId self.removed = removed - self.when_ = when_ + self.when = when } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModAddCommunityView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModAddCommunityView.swift index f9b8ca4..ebe058f 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModAddCommunityView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModAddCommunityView.swift @@ -1,20 +1,20 @@ import Foundation public struct ModAddCommunityView: Codable, Hashable { - public let mod_add_community: ModAddCommunity + public let modAddCommunity: ModAddCommunity public let moderator: Person? public let community: Community - public let modded_person: Person + public let moddedPerson: Person public init( - mod_add_community: ModAddCommunity, + modAddCommunity: ModAddCommunity, moderator: Person? = nil, community: Community, - modded_person: Person + moddedPerson: Person ) { - self.mod_add_community = mod_add_community + self.modAddCommunity = modAddCommunity self.moderator = moderator self.community = community - self.modded_person = modded_person + self.moddedPerson = moddedPerson } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModAddView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModAddView.swift index 7f5d045..6a22878 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModAddView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModAddView.swift @@ -1,17 +1,17 @@ import Foundation public struct ModAddView: Codable, Hashable { - public let mod_add: ModAdd + public let modAdd: ModAdd public let moderator: Person? - public let modded_person: Person + public let moddedPerson: Person public init( - mod_add: ModAdd, + modAdd: ModAdd, moderator: Person? = nil, - modded_person: Person + moddedPerson: Person ) { - self.mod_add = mod_add + self.modAdd = modAdd self.moderator = moderator - self.modded_person = modded_person + self.moddedPerson = moddedPerson } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModBan.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModBan.swift index c4992b3..cfdc295 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModBan.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModBan.swift @@ -2,28 +2,28 @@ import Foundation public struct ModBan: Codable, Identifiable, Hashable { public let id: Int - public let mod_person_id: PersonId - public let other_person_id: PersonId + public let modPersonId: PersonId + public let otherPersonId: PersonId public let reason: String? public let banned: Bool public let expires: String? - public let when_: String + public let when: String public init( id: Int, - mod_person_id: PersonId, - other_person_id: PersonId, + modPersonId: PersonId, + otherPersonId: PersonId, reason: String? = nil, banned: Bool, expires: String? = nil, - when_: String + when: String ) { self.id = id - self.mod_person_id = mod_person_id - self.other_person_id = other_person_id + self.modPersonId = modPersonId + self.otherPersonId = otherPersonId self.reason = reason self.banned = banned self.expires = expires - self.when_ = when_ + self.when = when } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModBanFromCommunity.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModBanFromCommunity.swift index 027d5d8..4f8b74b 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModBanFromCommunity.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModBanFromCommunity.swift @@ -2,31 +2,31 @@ import Foundation public struct ModBanFromCommunity: Codable, Identifiable, Hashable { public let id: Int - public let mod_person_id: PersonId - public let other_person_id: PersonId - public let community_id: CommunityId + public let modPersonId: PersonId + public let otherPersonId: PersonId + public let communityId: CommunityId public let reason: String? public let banned: Bool public let expires: String? - public let when_: String + public let when: String public init( id: Int, - mod_person_id: PersonId, - other_person_id: PersonId, - community_id: CommunityId, + modPersonId: PersonId, + otherPersonId: PersonId, + communityId: CommunityId, reason: String? = nil, banned: Bool, expires: String? = nil, - when_: String + when: String ) { self.id = id - self.mod_person_id = mod_person_id - self.other_person_id = other_person_id - self.community_id = community_id + self.modPersonId = modPersonId + self.otherPersonId = otherPersonId + self.communityId = communityId self.reason = reason self.banned = banned self.expires = expires - self.when_ = when_ + self.when = when } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModBanFromCommunityView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModBanFromCommunityView.swift index f941767..d9cd68c 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModBanFromCommunityView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModBanFromCommunityView.swift @@ -1,20 +1,20 @@ import Foundation public struct ModBanFromCommunityView: Codable, Hashable { - public let mod_ban_from_community: ModBanFromCommunity + public let modBanFromCommunity: ModBanFromCommunity public let moderator: Person? public let community: Community - public let banned_person: Person + public let bannedPerson: Person public init( - mod_ban_from_community: ModBanFromCommunity, + modBanFromCommunity: ModBanFromCommunity, moderator: Person? = nil, community: Community, - banned_person: Person + bannedPerson: Person ) { - self.mod_ban_from_community = mod_ban_from_community + self.modBanFromCommunity = modBanFromCommunity self.moderator = moderator self.community = community - self.banned_person = banned_person + self.bannedPerson = bannedPerson } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModBanView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModBanView.swift index fe3cf74..788bd0a 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModBanView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModBanView.swift @@ -1,17 +1,17 @@ import Foundation public struct ModBanView: Codable, Hashable { - public let mod_ban: ModBan + public let modBan: ModBan public let moderator: Person? - public let banned_person: Person + public let bannedPerson: Person public init( - mod_ban: ModBan, + modBan: ModBan, moderator: Person? = nil, - banned_person: Person + bannedPerson: Person ) { - self.mod_ban = mod_ban + self.modBan = modBan self.moderator = moderator - self.banned_person = banned_person + self.bannedPerson = bannedPerson } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModFeaturePost.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModFeaturePost.swift index 3d888d7..d7cba38 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModFeaturePost.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModFeaturePost.swift @@ -2,25 +2,25 @@ import Foundation public struct ModFeaturePost: Codable, Identifiable, Hashable { public let id: Int - public let mod_person_id: PersonId - public let post_id: PostId + public let modPersonId: PersonId + public let postId: PostId public let featured: Bool - public let when_: String - public let is_featured_community: Bool + public let when: String + public let isFeaturedCommunity: Bool public init( id: Int, - mod_person_id: PersonId, - post_id: PostId, + modPersonId: PersonId, + postId: PostId, featured: Bool, - when_: String, - is_featured_community: Bool + when: String, + isFeaturedCommunity: Bool ) { self.id = id - self.mod_person_id = mod_person_id - self.post_id = post_id + self.modPersonId = modPersonId + self.postId = postId self.featured = featured - self.when_ = when_ - self.is_featured_community = is_featured_community + self.when = when + self.isFeaturedCommunity = isFeaturedCommunity } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModFeaturePostView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModFeaturePostView.swift index f463c52..fedb566 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModFeaturePostView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModFeaturePostView.swift @@ -1,18 +1,18 @@ import Foundation public struct ModFeaturePostView: Codable, Hashable { - public let mod_feature_post: ModFeaturePost + public let modFeaturePost: ModFeaturePost public let moderator: Person? public let post: Post public let community: Community public init( - mod_feature_post: ModFeaturePost, + modFeaturePost: ModFeaturePost, moderator: Person? = nil, post: Post, community: Community ) { - self.mod_feature_post = mod_feature_post + self.modFeaturePost = modFeaturePost self.moderator = moderator self.post = post self.community = community diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModHideCommunity.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModHideCommunity.swift index 262997a..6208b53 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModHideCommunity.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModHideCommunity.swift @@ -2,24 +2,24 @@ import Foundation public struct ModHideCommunity: Codable, Identifiable, Hashable { public let id: Int - public let community_id: CommunityId - public let mod_person_id: PersonId - public let when_: String + public let communityId: CommunityId + public let modPersonId: PersonId + public let when: String public let reason: String? public let hidden: Bool public init( id: Int, - community_id: CommunityId, - mod_person_id: PersonId, - when_: String, + communityId: CommunityId, + modPersonId: PersonId, + when: String, reason: String? = nil, hidden: Bool ) { self.id = id - self.community_id = community_id - self.mod_person_id = mod_person_id - self.when_ = when_ + self.communityId = communityId + self.modPersonId = modPersonId + self.when = when self.reason = reason self.hidden = hidden } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModHideCommunityView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModHideCommunityView.swift index 0044902..7a48b89 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModHideCommunityView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModHideCommunityView.swift @@ -1,16 +1,16 @@ import Foundation public struct ModHideCommunityView: Codable, Hashable { - public let mod_hide_community: ModHideCommunity + public let modHideCommunity: ModHideCommunity public let admin: Person? public let community: Community public init( - mod_hide_community: ModHideCommunity, + modHideCommunity: ModHideCommunity, admin: Person? = nil, community: Community ) { - self.mod_hide_community = mod_hide_community + self.modHideCommunity = modHideCommunity self.admin = admin self.community = community } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModJoin.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModJoin.swift deleted file mode 100644 index fd39dbf..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModJoin.swift +++ /dev/null @@ -1,11 +0,0 @@ -import Foundation - -public struct ModJoin: Codable, Hashable { - public let community_id: CommunityId - - public init( - community_id: CommunityId - ) { - self.community_id = community_id - } -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModJoinResponse.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModJoinResponse.swift deleted file mode 100644 index 97a06c5..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModJoinResponse.swift +++ /dev/null @@ -1,11 +0,0 @@ -import Foundation - -public struct ModJoinResponse: Codable, Hashable { - public let joined: Bool - - public init( - joined: Bool - ) { - self.joined = joined - } -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModLockPost.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModLockPost.swift index 99a6d6b..5d9f67c 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModLockPost.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModLockPost.swift @@ -2,22 +2,22 @@ import Foundation public struct ModLockPost: Codable, Identifiable, Hashable { public let id: Int - public let mod_person_id: PersonId - public let post_id: PostId + public let modPersonId: PersonId + public let postId: PostId public let locked: Bool - public let when_: String + public let when: String public init( id: Int, - mod_person_id: PersonId, - post_id: PostId, + modPersonId: PersonId, + postId: PostId, locked: Bool, - when_: String + when: String ) { self.id = id - self.mod_person_id = mod_person_id - self.post_id = post_id + self.modPersonId = modPersonId + self.postId = postId self.locked = locked - self.when_ = when_ + self.when = when } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModLockPostView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModLockPostView.swift index fc223f6..ff3f23a 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModLockPostView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModLockPostView.swift @@ -1,18 +1,18 @@ import Foundation public struct ModLockPostView: Codable, Hashable { - public let mod_lock_post: ModLockPost + public let modLockPost: ModLockPost public let moderator: Person? public let post: Post public let community: Community public init( - mod_lock_post: ModLockPost, + modLockPost: ModLockPost, moderator: Person? = nil, post: Post, community: Community ) { - self.mod_lock_post = mod_lock_post + self.modLockPost = modLockPost self.moderator = moderator self.post = post self.community = community diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemoveComment.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemoveComment.swift index 5b6cdb5..77074f2 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemoveComment.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemoveComment.swift @@ -2,25 +2,25 @@ import Foundation public struct ModRemoveComment: Codable, Identifiable, Hashable { public let id: Int - public let mod_person_id: PersonId - public let comment_id: CommentId + public let modPersonId: PersonId + public let commentId: CommentId public let reason: String? public let removed: Bool - public let when_: String + public let when: String public init( id: Int, - mod_person_id: PersonId, - comment_id: CommentId, + modPersonId: PersonId, + commentId: CommentId, reason: String? = nil, removed: Bool, - when_: String + when: String ) { self.id = id - self.mod_person_id = mod_person_id - self.comment_id = comment_id + self.modPersonId = modPersonId + self.commentId = commentId self.reason = reason self.removed = removed - self.when_ = when_ + self.when = when } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemoveCommentView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemoveCommentView.swift index d385318..51c5f5c 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemoveCommentView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemoveCommentView.swift @@ -1,7 +1,7 @@ import Foundation public struct ModRemoveCommentView: Codable, Hashable { - public let mod_remove_comment: ModRemoveComment + public let modRemoveComment: ModRemoveComment public let moderator: Person? public let comment: Comment public let commenter: Person @@ -9,14 +9,14 @@ public struct ModRemoveCommentView: Codable, Hashable { public let community: Community public init( - mod_remove_comment: ModRemoveComment, + modRemoveComment: ModRemoveComment, moderator: Person? = nil, comment: Comment, commenter: Person, post: Post, community: Community ) { - self.mod_remove_comment = mod_remove_comment + self.modRemoveComment = modRemoveComment self.moderator = moderator self.comment = comment self.commenter = commenter diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemoveCommunity.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemoveCommunity.swift index 96a6483..1fcda24 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemoveCommunity.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemoveCommunity.swift @@ -2,28 +2,25 @@ import Foundation public struct ModRemoveCommunity: Codable, Identifiable, Hashable { public let id: Int - public let mod_person_id: PersonId - public let community_id: CommunityId + public let modPersonId: PersonId + public let communityId: CommunityId public let reason: String? public let removed: Bool - public let expires: String? - public let when_: String + public let when: String public init( id: Int, - mod_person_id: PersonId, - community_id: CommunityId, + modPersonId: PersonId, + communityId: CommunityId, reason: String? = nil, removed: Bool, - expires: String? = nil, - when_: String + when: String ) { self.id = id - self.mod_person_id = mod_person_id - self.community_id = community_id + self.modPersonId = modPersonId + self.communityId = communityId self.reason = reason self.removed = removed - self.expires = expires - self.when_ = when_ + self.when = when } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemoveCommunityView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemoveCommunityView.swift index 5f35adf..cdf5a60 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemoveCommunityView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemoveCommunityView.swift @@ -1,16 +1,16 @@ import Foundation public struct ModRemoveCommunityView: Codable, Hashable { - public let mod_remove_community: ModRemoveCommunity + public let modRemoveCommunity: ModRemoveCommunity public let moderator: Person? public let community: Community public init( - mod_remove_community: ModRemoveCommunity, + modRemoveCommunity: ModRemoveCommunity, moderator: Person? = nil, community: Community ) { - self.mod_remove_community = mod_remove_community + self.modRemoveCommunity = modRemoveCommunity self.moderator = moderator self.community = community } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemovePost.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemovePost.swift index 1a06367..926da25 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemovePost.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemovePost.swift @@ -2,25 +2,25 @@ import Foundation public struct ModRemovePost: Codable, Identifiable, Hashable { public let id: Int - public let mod_person_id: PersonId - public let post_id: PostId + public let modPersonId: PersonId + public let postId: PostId public let reason: String? public let removed: Bool - public let when_: String + public let when: String public init( id: Int, - mod_person_id: PersonId, - post_id: PostId, + modPersonId: PersonId, + postId: PostId, reason: String? = nil, removed: Bool, - when_: String + when: String ) { self.id = id - self.mod_person_id = mod_person_id - self.post_id = post_id + self.modPersonId = modPersonId + self.postId = postId self.reason = reason self.removed = removed - self.when_ = when_ + self.when = when } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemovePostView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemovePostView.swift index eea75a0..2b45bc9 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemovePostView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModRemovePostView.swift @@ -1,18 +1,18 @@ import Foundation public struct ModRemovePostView: Codable, Hashable { - public let mod_remove_post: ModRemovePost + public let modRemovePost: ModRemovePost public let moderator: Person? public let post: Post public let community: Community public init( - mod_remove_post: ModRemovePost, + modRemovePost: ModRemovePost, moderator: Person? = nil, post: Post, community: Community ) { - self.mod_remove_post = mod_remove_post + self.modRemovePost = modRemovePost self.moderator = moderator self.post = post self.community = community diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModTransferCommunity.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModTransferCommunity.swift index 86a0832..85854d7 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModTransferCommunity.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModTransferCommunity.swift @@ -2,22 +2,22 @@ import Foundation public struct ModTransferCommunity: Codable, Identifiable, Hashable { public let id: Int - public let mod_person_id: PersonId - public let other_person_id: PersonId - public let community_id: CommunityId - public let when_: String + public let modPersonId: PersonId + public let otherPersonId: PersonId + public let communityId: CommunityId + public let when: String public init( id: Int, - mod_person_id: PersonId, - other_person_id: PersonId, - community_id: CommunityId, - when_: String + modPersonId: PersonId, + otherPersonId: PersonId, + communityId: CommunityId, + when: String ) { self.id = id - self.mod_person_id = mod_person_id - self.other_person_id = other_person_id - self.community_id = community_id - self.when_ = when_ + self.modPersonId = modPersonId + self.otherPersonId = otherPersonId + self.communityId = communityId + self.when = when } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModTransferCommunityView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModTransferCommunityView.swift index d152176..f1d5acc 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModTransferCommunityView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModTransferCommunityView.swift @@ -1,20 +1,20 @@ import Foundation public struct ModTransferCommunityView: Codable, Hashable { - public let mod_transfer_community: ModTransferCommunity + public let modTransferCommunity: ModTransferCommunity public let moderator: Person? public let community: Community - public let modded_person: Person + public let moddedPerson: Person public init( - mod_transfer_community: ModTransferCommunity, + modTransferCommunity: ModTransferCommunity, moderator: Person? = nil, community: Community, - modded_person: Person + moddedPerson: Person ) { - self.mod_transfer_community = mod_transfer_community + self.modTransferCommunity = modTransferCommunity self.moderator = moderator self.community = community - self.modded_person = modded_person + self.moddedPerson = moddedPerson } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModlogListParams.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModlogListParams.swift index ce55e10..b221509 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModlogListParams.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModlogListParams.swift @@ -1,26 +1,26 @@ import Foundation public struct ModlogListParams: Codable, Hashable { - public let community_id: CommunityId? - public let mod_person_id: PersonId? - public let other_person_id: PersonId? + public let communityId: CommunityId? + public let modPersonId: PersonId? + public let otherPersonId: PersonId? public let page: Int? public let limit: Int? - public let hide_modlog_names: Bool + public let hideModlogNames: Bool public init( - community_id: CommunityId? = nil, - mod_person_id: PersonId? = nil, - other_person_id: PersonId? = nil, + communityId: CommunityId? = nil, + modPersonId: PersonId? = nil, + otherPersonId: PersonId? = nil, page: Int? = nil, limit: Int? = nil, - hide_modlog_names: Bool + hideModlogNames: Bool ) { - self.community_id = community_id - self.mod_person_id = mod_person_id - self.other_person_id = other_person_id + self.communityId = communityId + self.modPersonId = modPersonId + self.otherPersonId = otherPersonId self.page = page self.limit = limit - self.hide_modlog_names = hide_modlog_names + self.hideModlogNames = hideModlogNames } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/MyUserInfo.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/MyUserInfo.swift index df54ebe..16e2648 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/MyUserInfo.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/MyUserInfo.swift @@ -1,26 +1,29 @@ import Foundation public struct MyUserInfo: Codable, Hashable { - public let local_user_view: LocalUserView + public let localUserView: LocalUserView public let follows: [CommunityFollowerView] public let moderates: [CommunityModeratorView] - public let community_blocks: [CommunityBlockView] - public let person_blocks: [PersonBlockView] - public let discussion_languages: [LanguageId] + public let communityBlocks: [CommunityBlockView] + public let instanceBlocks: [InstanceBlockView] + public let personBlocks: [PersonBlockView] + public let discussionLanguages: [LanguageId] public init( - local_user_view: LocalUserView, + localUserView: LocalUserView, follows: [CommunityFollowerView], moderates: [CommunityModeratorView], - community_blocks: [CommunityBlockView], - person_blocks: [PersonBlockView], - discussion_languages: [LanguageId] + communityBlocks: [CommunityBlockView], + instanceBlocks: [InstanceBlockView], + personBlocks: [PersonBlockView], + discussionLanguages: [LanguageId] ) { - self.local_user_view = local_user_view + self.localUserView = localUserView self.follows = follows self.moderates = moderates - self.community_blocks = community_blocks - self.person_blocks = person_blocks - self.discussion_languages = discussion_languages + self.communityBlocks = communityBlocks + self.instanceBlocks = instanceBlocks + self.personBlocks = personBlocks + self.discussionLanguages = discussionLanguages } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Person.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Person.swift index 0c77a29..8e3ac3e 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Person.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Person.swift @@ -3,57 +3,54 @@ import Foundation public struct Person: Codable, Identifiable, Hashable { public let id: PersonId public let name: String - public let display_name: String? + public let displayName: String? public let avatar: String? public let banned: Bool public let published: String public let updated: String? - public let actor_id: String + public let actorId: String public let bio: String? public let local: Bool public let banner: String? public let deleted: Bool - public let matrix_user_id: String? - public let admin: Bool - public let bot_account: Bool - public let ban_expires: String? - public let instance_id: InstanceId + public let matrixUserId: String? + public let botAccount: Bool + public let banExpires: String? + public let instanceId: InstanceId public init( id: PersonId, name: String, - display_name: String? = nil, + displayName: String? = nil, avatar: String? = nil, banned: Bool, published: String, updated: String? = nil, - actor_id: String, + actorId: String, bio: String? = nil, local: Bool, banner: String? = nil, deleted: Bool, - matrix_user_id: String? = nil, - admin: Bool, - bot_account: Bool, - ban_expires: String? = nil, - instance_id: InstanceId + matrixUserId: String? = nil, + botAccount: Bool, + banExpires: String? = nil, + instanceId: InstanceId ) { self.id = id self.name = name - self.display_name = display_name + self.displayName = displayName self.avatar = avatar self.banned = banned self.published = published self.updated = updated - self.actor_id = actor_id + self.actorId = actorId self.bio = bio self.local = local self.banner = banner self.deleted = deleted - self.matrix_user_id = matrix_user_id - self.admin = admin - self.bot_account = bot_account - self.ban_expires = ban_expires - self.instance_id = instance_id + self.matrixUserId = matrixUserId + self.botAccount = botAccount + self.banExpires = banExpires + self.instanceId = instanceId } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PersonAggregates.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PersonAggregates.swift index 9546d83..9bc3ff0 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PersonAggregates.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PersonAggregates.swift @@ -1,26 +1,17 @@ import Foundation -public struct PersonAggregates: Codable, Identifiable, Hashable { - public let id: Int - public let person_id: PersonId - public let post_count: Int - public let post_score: Int - public let comment_count: Int - public let comment_score: Int +public struct PersonAggregates: Codable, Hashable { + public let personId: PersonId + public let postCount: Int + public let commentCount: Int public init( - id: Int, - person_id: PersonId, - post_count: Int, - post_score: Int, - comment_count: Int, - comment_score: Int + personId: PersonId, + postCount: Int, + commentCount: Int ) { - self.id = id - self.person_id = person_id - self.post_count = post_count - self.post_score = post_score - self.comment_count = comment_count - self.comment_score = comment_score + self.personId = personId + self.postCount = postCount + self.commentCount = commentCount } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PersonMention.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PersonMention.swift index fc4f59f..332afdf 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PersonMention.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PersonMention.swift @@ -2,21 +2,21 @@ import Foundation public struct PersonMention: Codable, Identifiable, Hashable { public let id: PersonMentionId - public let recipient_id: PersonId - public let comment_id: CommentId + public let recipientId: PersonId + public let commentId: CommentId public let read: Bool public let published: String public init( id: PersonMentionId, - recipient_id: PersonId, - comment_id: CommentId, + recipientId: PersonId, + commentId: CommentId, read: Bool, published: String ) { self.id = id - self.recipient_id = recipient_id - self.comment_id = comment_id + self.recipientId = recipientId + self.commentId = commentId self.read = read self.published = published } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PersonMentionView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PersonMentionView.swift index 0627435..d6fe6b0 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PersonMentionView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PersonMentionView.swift @@ -1,44 +1,50 @@ import Foundation public struct PersonMentionView: Codable, Hashable { - public let person_mention: PersonMention + public let personMention: PersonMention public let comment: Comment public let creator: Person public let post: Post public let community: Community public let recipient: Person public let counts: CommentAggregates - public let creator_banned_from_community: Bool + public let creatorBannedFromCommunity: Bool + public let creatorIsModerator: Bool + public let creatorIsAdmin: Bool public let subscribed: SubscribedType public let saved: Bool - public let creator_blocked: Bool - public let my_vote: Int? + public let creatorBlocked: Bool + public let myVote: Int? public init( - person_mention: PersonMention, + personMention: PersonMention, comment: Comment, creator: Person, post: Post, community: Community, recipient: Person, counts: CommentAggregates, - creator_banned_from_community: Bool, + creatorBannedFromCommunity: Bool, + creatorIsModerator: Bool, + creatorIsAdmin: Bool, subscribed: SubscribedType, saved: Bool, - creator_blocked: Bool, - my_vote: Int? = nil + creatorBlocked: Bool, + myVote: Int? = nil ) { - self.person_mention = person_mention + self.personMention = personMention self.comment = comment self.creator = creator self.post = post self.community = community self.recipient = recipient self.counts = counts - self.creator_banned_from_community = creator_banned_from_community + self.creatorBannedFromCommunity = creatorBannedFromCommunity + self.creatorIsModerator = creatorIsModerator + self.creatorIsAdmin = creatorIsAdmin self.subscribed = subscribed self.saved = saved - self.creator_blocked = creator_blocked - self.my_vote = my_vote + self.creatorBlocked = creatorBlocked + self.myVote = myVote } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PersonView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PersonView.swift index d85cdf3..6374fae 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PersonView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PersonView.swift @@ -3,12 +3,15 @@ import Foundation public struct PersonView: Codable, Hashable { public let person: Person public let counts: PersonAggregates + public let isAdmin: Bool public init( person: Person, - counts: PersonAggregates + counts: PersonAggregates, + isAdmin: Bool ) { self.person = person self.counts = counts + self.isAdmin = isAdmin } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Post.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Post.swift index 80d37e7..8790239 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Post.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Post.swift @@ -5,67 +5,67 @@ public struct Post: Codable, Identifiable, Hashable { public let name: String public let url: String? public let body: String? - public let creator_id: PersonId - public let community_id: CommunityId + public let creatorId: PersonId + public let communityId: CommunityId public let removed: Bool public let locked: Bool public let published: String public let updated: String? public let deleted: Bool public let nsfw: Bool - public let embed_title: String? - public let embed_description: String? - public let thumbnail_url: String? - public let ap_id: String + public let embedTitle: String? + public let embedDescription: String? + public let thumbnailUrl: String? + public let apId: String public let local: Bool - public let embed_video_url: String? - public let language_id: LanguageId - public let featured_community: Bool - public let featured_local: Bool + public let embedVideoUrl: String? + public let languageId: LanguageId + public let featuredCommunity: Bool + public let featuredLocal: Bool public init( id: PostId, name: String, url: String? = nil, body: String? = nil, - creator_id: PersonId, - community_id: CommunityId, + creatorId: PersonId, + communityId: CommunityId, removed: Bool, locked: Bool, published: String, updated: String? = nil, deleted: Bool, nsfw: Bool, - embed_title: String? = nil, - embed_description: String? = nil, - thumbnail_url: String? = nil, - ap_id: String, + embedTitle: String? = nil, + embedDescription: String? = nil, + thumbnailUrl: String? = nil, + apId: String, local: Bool, - embed_video_url: String? = nil, - language_id: LanguageId, - featured_community: Bool, - featured_local: Bool + embedVideoUrl: String? = nil, + languageId: LanguageId, + featuredCommunity: Bool, + featuredLocal: Bool ) { self.id = id self.name = name self.url = url self.body = body - self.creator_id = creator_id - self.community_id = community_id + self.creatorId = creatorId + self.communityId = communityId self.removed = removed self.locked = locked self.published = published self.updated = updated self.deleted = deleted self.nsfw = nsfw - self.embed_title = embed_title - self.embed_description = embed_description - self.thumbnail_url = thumbnail_url - self.ap_id = ap_id + self.embedTitle = embedTitle + self.embedDescription = embedDescription + self.thumbnailUrl = thumbnailUrl + self.apId = apId self.local = local - self.embed_video_url = embed_video_url - self.language_id = language_id - self.featured_community = featured_community - self.featured_local = featured_local + self.embedVideoUrl = embedVideoUrl + self.languageId = languageId + self.featuredCommunity = featuredCommunity + self.featuredLocal = featuredLocal } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PostAggregates.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PostAggregates.swift index 3f0df16..758b69c 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PostAggregates.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PostAggregates.swift @@ -1,47 +1,26 @@ import Foundation -public struct PostAggregates: Codable, Identifiable, Hashable { - public let id: Int - public let post_id: PostId +public struct PostAggregates: Codable, Hashable { + public let postId: PostId public let comments: Int public let score: Int public let upvotes: Int public let downvotes: Int public let published: String - public let newest_comment_time_necro: String - public let newest_comment_time: String - public let featured_community: Bool - public let featured_local: Bool - public let hot_rank: Int - public let hot_rank_active: Int public init( - id: Int, - post_id: PostId, + postId: PostId, comments: Int, score: Int, upvotes: Int, downvotes: Int, - published: String, - newest_comment_time_necro: String, - newest_comment_time: String, - featured_community: Bool, - featured_local: Bool, - hot_rank: Int, - hot_rank_active: Int + published: String ) { - self.id = id - self.post_id = post_id + self.postId = postId self.comments = comments self.score = score self.upvotes = upvotes self.downvotes = downvotes self.published = published - self.newest_comment_time_necro = newest_comment_time_necro - self.newest_comment_time = newest_comment_time - self.featured_community = featured_community - self.featured_local = featured_local - self.hot_rank = hot_rank - self.hot_rank_active = hot_rank_active } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PostJoin.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PostJoin.swift deleted file mode 100644 index 48a4547..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PostJoin.swift +++ /dev/null @@ -1,11 +0,0 @@ -import Foundation - -public struct PostJoin: Codable, Hashable { - public let post_id: PostId - - public init( - post_id: PostId - ) { - self.post_id = post_id - } -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PostJoinResponse.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PostJoinResponse.swift deleted file mode 100644 index d3715a0..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PostJoinResponse.swift +++ /dev/null @@ -1,11 +0,0 @@ -import Foundation - -public struct PostJoinResponse: Codable, Hashable { - public let joined: Bool - - public init( - joined: Bool - ) { - self.joined = joined - } -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PostReport.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PostReport.swift index 6ac8ef5..71bf7f3 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PostReport.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PostReport.swift @@ -2,39 +2,39 @@ import Foundation public struct PostReport: Codable, Identifiable, Hashable { public let id: PostReportId - public let creator_id: PersonId - public let post_id: PostId - public let original_post_name: String - public let original_post_url: String? - public let original_post_body: String? + public let creatorId: PersonId + public let postId: PostId + public let originalPostName: String + public let originalPostUrl: String? + public let originalPostBody: String? public let reason: String public let resolved: Bool - public let resolver_id: PersonId? + public let resolverId: PersonId? public let published: String public let updated: String? public init( id: PostReportId, - creator_id: PersonId, - post_id: PostId, - original_post_name: String, - original_post_url: String? = nil, - original_post_body: String? = nil, + creatorId: PersonId, + postId: PostId, + originalPostName: String, + originalPostUrl: String? = nil, + originalPostBody: String? = nil, reason: String, resolved: Bool, - resolver_id: PersonId? = nil, + resolverId: PersonId? = nil, published: String, updated: String? = nil ) { self.id = id - self.creator_id = creator_id - self.post_id = post_id - self.original_post_name = original_post_name - self.original_post_url = original_post_url - self.original_post_body = original_post_body + self.creatorId = creatorId + self.postId = postId + self.originalPostName = originalPostName + self.originalPostUrl = originalPostUrl + self.originalPostBody = originalPostBody self.reason = reason self.resolved = resolved - self.resolver_id = resolver_id + self.resolverId = resolverId self.published = published self.updated = updated } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PostReportView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PostReportView.swift index a3d38aa..840831f 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PostReportView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PostReportView.swift @@ -1,34 +1,34 @@ import Foundation public struct PostReportView: Codable, Hashable { - public let post_report: PostReport + public let postReport: PostReport public let post: Post public let community: Community public let creator: Person - public let post_creator: Person - public let creator_banned_from_community: Bool - public let my_vote: Int? + public let postCreator: Person + public let creatorBannedFromCommunity: Bool + public let myVote: Int? public let counts: PostAggregates public let resolver: Person? public init( - post_report: PostReport, + postReport: PostReport, post: Post, community: Community, creator: Person, - post_creator: Person, - creator_banned_from_community: Bool, - my_vote: Int? = nil, + postCreator: Person, + creatorBannedFromCommunity: Bool, + myVote: Int? = nil, counts: PostAggregates, resolver: Person? = nil ) { - self.post_report = post_report + self.postReport = postReport self.post = post self.community = community self.creator = creator - self.post_creator = post_creator - self.creator_banned_from_community = creator_banned_from_community - self.my_vote = my_vote + self.postCreator = postCreator + self.creatorBannedFromCommunity = creatorBannedFromCommunity + self.myVote = myVote self.counts = counts self.resolver = resolver } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PostView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PostView.swift index 92328c0..e2e02d2 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PostView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PostView.swift @@ -4,38 +4,44 @@ public struct PostView: Codable, Hashable { public let post: Post public let creator: Person public let community: Community - public let creator_banned_from_community: Bool + public let creatorBannedFromCommunity: Bool + public let creatorIsModerator: Bool + public let creatorIsAdmin: Bool public let counts: PostAggregates public let subscribed: SubscribedType public let saved: Bool public let read: Bool - public let creator_blocked: Bool - public let my_vote: Int? - public let unread_comments: Int + public let creatorBlocked: Bool + public let myVote: Int? + public let unreadComments: Int public init( post: Post, creator: Person, community: Community, - creator_banned_from_community: Bool, + creatorBannedFromCommunity: Bool, + creatorIsModerator: Bool, + creatorIsAdmin: Bool, counts: PostAggregates, subscribed: SubscribedType, saved: Bool, read: Bool, - creator_blocked: Bool, - my_vote: Int? = nil, - unread_comments: Int + creatorBlocked: Bool, + myVote: Int? = nil, + unreadComments: Int ) { self.post = post self.creator = creator self.community = community - self.creator_banned_from_community = creator_banned_from_community + self.creatorBannedFromCommunity = creatorBannedFromCommunity + self.creatorIsModerator = creatorIsModerator + self.creatorIsAdmin = creatorIsAdmin self.counts = counts self.subscribed = subscribed self.saved = saved self.read = read - self.creator_blocked = creator_blocked - self.my_vote = my_vote - self.unread_comments = unread_comments + self.creatorBlocked = creatorBlocked + self.myVote = myVote + self.unreadComments = unreadComments } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessage.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessage.swift index cf6b5db..02c51ec 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessage.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessage.swift @@ -2,37 +2,37 @@ import Foundation public struct PrivateMessage: Codable, Identifiable, Hashable { public let id: PrivateMessageId - public let creator_id: PersonId - public let recipient_id: PersonId + public let creatorId: PersonId + public let recipientId: PersonId public let content: String public let deleted: Bool public let read: Bool public let published: String public let updated: String? - public let ap_id: String + public let apId: String public let local: Bool public init( id: PrivateMessageId, - creator_id: PersonId, - recipient_id: PersonId, + creatorId: PersonId, + recipientId: PersonId, content: String, deleted: Bool, read: Bool, published: String, updated: String? = nil, - ap_id: String, + apId: String, local: Bool ) { self.id = id - self.creator_id = creator_id - self.recipient_id = recipient_id + self.creatorId = creatorId + self.recipientId = recipientId self.content = content self.deleted = deleted self.read = read self.published = published self.updated = updated - self.ap_id = ap_id + self.apId = apId self.local = local } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessageReport.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessageReport.swift index 5ad33d9..70030eb 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessageReport.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessageReport.swift @@ -2,33 +2,33 @@ import Foundation public struct PrivateMessageReport: Codable, Identifiable, Hashable { public let id: PrivateMessageReportId - public let creator_id: PersonId - public let private_message_id: PrivateMessageId - public let original_pm_text: String + public let creatorId: PersonId + public let privateMessageId: PrivateMessageId + public let originalPmText: String public let reason: String public let resolved: Bool - public let resolver_id: PersonId? + public let resolverId: PersonId? public let published: String public let updated: String? public init( id: PrivateMessageReportId, - creator_id: PersonId, - private_message_id: PrivateMessageId, - original_pm_text: String, + creatorId: PersonId, + privateMessageId: PrivateMessageId, + originalPmText: String, reason: String, resolved: Bool, - resolver_id: PersonId? = nil, + resolverId: PersonId? = nil, published: String, updated: String? = nil ) { self.id = id - self.creator_id = creator_id - self.private_message_id = private_message_id - self.original_pm_text = original_pm_text + self.creatorId = creatorId + self.privateMessageId = privateMessageId + self.originalPmText = originalPmText self.reason = reason self.resolved = resolved - self.resolver_id = resolver_id + self.resolverId = resolverId self.published = published self.updated = updated } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessageReportResponse.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessageReportResponse.swift index 5a63bd4..0a79978 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessageReportResponse.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessageReportResponse.swift @@ -1,11 +1,11 @@ import Foundation public struct PrivateMessageReportResponse: Codable, Hashable { - public let private_message_report_view: PrivateMessageReportView + public let privateMessageReportView: PrivateMessageReportView public init( - private_message_report_view: PrivateMessageReportView + privateMessageReportView: PrivateMessageReportView ) { - self.private_message_report_view = private_message_report_view + self.privateMessageReportView = privateMessageReportView } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessageReportView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessageReportView.swift index dc2fe52..bd75c68 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessageReportView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessageReportView.swift @@ -1,22 +1,22 @@ import Foundation public struct PrivateMessageReportView: Codable, Hashable { - public let private_message_report: PrivateMessageReport - public let private_message: PrivateMessage - public let private_message_creator: Person + public let privateMessageReport: PrivateMessageReport + public let privateMessage: PrivateMessage + public let privateMessageCreator: Person public let creator: Person public let resolver: Person? public init( - private_message_report: PrivateMessageReport, - private_message: PrivateMessage, - private_message_creator: Person, + privateMessageReport: PrivateMessageReport, + privateMessage: PrivateMessage, + privateMessageCreator: Person, creator: Person, resolver: Person? = nil ) { - self.private_message_report = private_message_report - self.private_message = private_message - self.private_message_creator = private_message_creator + self.privateMessageReport = privateMessageReport + self.privateMessage = privateMessage + self.privateMessageCreator = privateMessageCreator self.creator = creator self.resolver = resolver } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessageView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessageView.swift index 65f076a..cb50a95 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessageView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/PrivateMessageView.swift @@ -1,16 +1,16 @@ import Foundation public struct PrivateMessageView: Codable, Hashable { - public let private_message: PrivateMessage + public let privateMessage: PrivateMessage public let creator: Person public let recipient: Person public init( - private_message: PrivateMessage, + privateMessage: PrivateMessage, creator: Person, recipient: Person ) { - self.private_message = private_message + self.privateMessage = privateMessage self.creator = creator self.recipient = recipient } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ReadableFederationState.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ReadableFederationState.swift new file mode 100644 index 0000000..4c44642 --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ReadableFederationState.swift @@ -0,0 +1,26 @@ +import Foundation + +public struct ReadableFederationState: Codable, Hashable { + public let instanceId: InstanceId + public let lastSuccessfulId: ActivityId? + public let lastSuccessfulPublishedTime: String? + public let failCount: Int + public let lastRetry: String? + public let nextRetry: String? + + public init( + instanceId: InstanceId, + lastSuccessfulId: ActivityId? = nil, + lastSuccessfulPublishedTime: String? = nil, + failCount: Int, + lastRetry: String? = nil, + nextRetry: String? = nil + ) { + self.instanceId = instanceId + self.lastSuccessfulId = lastSuccessfulId + self.lastSuccessfulPublishedTime = lastSuccessfulPublishedTime + self.failCount = failCount + self.lastRetry = lastRetry + self.nextRetry = nextRetry + } +} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/RegistrationApplication.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/RegistrationApplication.swift index 952378e..bf5d8fa 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/RegistrationApplication.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/RegistrationApplication.swift @@ -2,25 +2,25 @@ import Foundation public struct RegistrationApplication: Codable, Identifiable, Hashable { public let id: Int - public let local_user_id: LocalUserId + public let localUserId: LocalUserId public let answer: String - public let admin_id: PersonId? - public let deny_reason: String? + public let adminId: PersonId? + public let denyReason: String? public let published: String public init( id: Int, - local_user_id: LocalUserId, + localUserId: LocalUserId, answer: String, - admin_id: PersonId? = nil, - deny_reason: String? = nil, + adminId: PersonId? = nil, + denyReason: String? = nil, published: String ) { self.id = id - self.local_user_id = local_user_id + self.localUserId = localUserId self.answer = answer - self.admin_id = admin_id - self.deny_reason = deny_reason + self.adminId = adminId + self.denyReason = denyReason self.published = published } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/RegistrationApplicationResponse.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/RegistrationApplicationResponse.swift index 04a9205..b9f4836 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/RegistrationApplicationResponse.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/RegistrationApplicationResponse.swift @@ -1,11 +1,11 @@ import Foundation public struct RegistrationApplicationResponse: Codable, Hashable { - public let registration_application: RegistrationApplicationView + public let registrationApplication: RegistrationApplicationView public init( - registration_application: RegistrationApplicationView + registrationApplication: RegistrationApplicationView ) { - self.registration_application = registration_application + self.registrationApplication = registrationApplication } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/RegistrationApplicationView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/RegistrationApplicationView.swift index dca517c..a9d66b4 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/RegistrationApplicationView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/RegistrationApplicationView.swift @@ -1,19 +1,19 @@ import Foundation public struct RegistrationApplicationView: Codable, Hashable { - public let registration_application: RegistrationApplication - public let creator_local_user: LocalUser + public let registrationApplication: RegistrationApplication + public let creatorLocalUser: LocalUser public let creator: Person public let admin: Person? public init( - registration_application: RegistrationApplication, - creator_local_user: LocalUser, + registrationApplication: RegistrationApplication, + creatorLocalUser: LocalUser, creator: Person, admin: Person? = nil ) { - self.registration_application = registration_application - self.creator_local_user = creator_local_user + self.registrationApplication = registrationApplication + self.creatorLocalUser = creatorLocalUser self.creator = creator self.admin = admin } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ResolvePrivateMessageReport.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ResolvePrivateMessageReport.swift index a584da1..945863e 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ResolvePrivateMessageReport.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/ResolvePrivateMessageReport.swift @@ -1,17 +1,14 @@ import Foundation public struct ResolvePrivateMessageReport: Codable, Hashable { - public let report_id: PrivateMessageReportId + public let reportId: PrivateMessageReportId public let resolved: Bool - public let auth: String public init( - report_id: PrivateMessageReportId, - resolved: Bool, - auth: String + reportId: PrivateMessageReportId, + resolved: Bool ) { - self.report_id = report_id + self.reportId = reportId self.resolved = resolved - self.auth = auth } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Site.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Site.swift index 384ac6a..02c5f2f 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Site.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Site.swift @@ -9,12 +9,12 @@ public struct Site: Codable, Identifiable, Hashable { public let icon: String? public let banner: String? public let description: String? - public let actor_id: String - public let last_refreshed_at: String - public let inbox_url: String - public let private_key: String? - public let public_key: String - public let instance_id: InstanceId + public let actorId: String + public let lastRefreshedAt: String + public let inboxUrl: String + public let privateKey: String? + public let publicKey: String + public let instanceId: InstanceId public init( id: SiteId, @@ -25,12 +25,12 @@ public struct Site: Codable, Identifiable, Hashable { icon: String? = nil, banner: String? = nil, description: String? = nil, - actor_id: String, - last_refreshed_at: String, - inbox_url: String, - private_key: String? = nil, - public_key: String, - instance_id: InstanceId + actorId: String, + lastRefreshedAt: String, + inboxUrl: String, + privateKey: String? = nil, + publicKey: String, + instanceId: InstanceId ) { self.id = id self.name = name @@ -40,11 +40,11 @@ public struct Site: Codable, Identifiable, Hashable { self.icon = icon self.banner = banner self.description = description - self.actor_id = actor_id - self.last_refreshed_at = last_refreshed_at - self.inbox_url = inbox_url - self.private_key = private_key - self.public_key = public_key - self.instance_id = instance_id + self.actorId = actorId + self.lastRefreshedAt = lastRefreshedAt + self.inboxUrl = inboxUrl + self.privateKey = privateKey + self.publicKey = publicKey + self.instanceId = instanceId } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/SiteAggregates.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/SiteAggregates.swift index 9febdb3..5de0e40 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/SiteAggregates.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/SiteAggregates.swift @@ -1,38 +1,35 @@ import Foundation -public struct SiteAggregates: Codable, Identifiable, Hashable { - public let id: Int - public let site_id: SiteId +public struct SiteAggregates: Codable, Hashable { + public let siteId: SiteId public let users: Int public let posts: Int public let comments: Int public let communities: Int - public let users_active_day: Int - public let users_active_week: Int - public let users_active_month: Int - public let users_active_half_year: Int + public let usersActiveDay: Int + public let usersActiveWeek: Int + public let usersActiveMonth: Int + public let usersActiveHalfYear: Int public init( - id: Int, - site_id: SiteId, + siteId: SiteId, users: Int, posts: Int, comments: Int, communities: Int, - users_active_day: Int, - users_active_week: Int, - users_active_month: Int, - users_active_half_year: Int + usersActiveDay: Int, + usersActiveWeek: Int, + usersActiveMonth: Int, + usersActiveHalfYear: Int ) { - self.id = id - self.site_id = site_id + self.siteId = siteId self.users = users self.posts = posts self.comments = comments self.communities = communities - self.users_active_day = users_active_day - self.users_active_week = users_active_week - self.users_active_month = users_active_month - self.users_active_half_year = users_active_half_year + self.usersActiveDay = usersActiveDay + self.usersActiveWeek = usersActiveWeek + self.usersActiveMonth = usersActiveMonth + self.usersActiveHalfYear = usersActiveHalfYear } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/SiteMetadata.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/SiteMetadata.swift index a6d2fe2..cb1392c 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/SiteMetadata.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/SiteMetadata.swift @@ -4,17 +4,17 @@ public struct SiteMetadata: Codable, Hashable { public let title: String? public let description: String? public let image: String? - public let embed_video_url: String? + public let embedVideoUrl: String? public init( title: String? = nil, description: String? = nil, image: String? = nil, - embed_video_url: String? = nil + embedVideoUrl: String? = nil ) { self.title = title self.description = description self.image = image - self.embed_video_url = embed_video_url + self.embedVideoUrl = embedVideoUrl } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/SiteView.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/SiteView.swift index 648f02f..7e8fc39 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/SiteView.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/SiteView.swift @@ -2,19 +2,19 @@ import Foundation public struct SiteView: Codable, Hashable { public let site: Site - public let local_site: LocalSite - public let local_site_rate_limit: LocalSiteRateLimit + public let localSite: LocalSite + public let localSiteRateLimit: LocalSiteRateLimit public let counts: SiteAggregates public init( site: Site, - local_site: LocalSite, - local_site_rate_limit: LocalSiteRateLimit, + localSite: LocalSite, + localSiteRateLimit: LocalSiteRateLimit, counts: SiteAggregates ) { self.site = site - self.local_site = local_site - self.local_site_rate_limit = local_site_rate_limit + self.localSite = localSite + self.localSiteRateLimit = localSiteRateLimit self.counts = counts } } diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Tagline.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Tagline.swift index 7ffcf6d..cbe320c 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Tagline.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/Tagline.swift @@ -2,20 +2,20 @@ import Foundation public struct Tagline: Codable, Identifiable, Hashable { public let id: Int - public let local_site_id: LocalSiteId + public let localSiteId: LocalSiteId public let content: String public let published: String public let updated: String? public init( id: Int, - local_site_id: LocalSiteId, + localSiteId: LocalSiteId, content: String, published: String, updated: String? = nil ) { self.id = id - self.local_site_id = local_site_id + self.localSiteId = localSiteId self.content = content self.published = published self.updated = updated diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/UserJoinResponse.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Structs/UserJoinResponse.swift deleted file mode 100644 index 9da0eb1..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Structs/UserJoinResponse.swift +++ /dev/null @@ -1,11 +0,0 @@ -import Foundation - -public struct UserJoinResponse: Codable, Hashable { - public let joined: Bool - - public init( - joined: Bool - ) { - self.joined = joined - } -} diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Types/ActivityId.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Types/ActivityId.swift new file mode 100644 index 0000000..a86ae21 --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Types/ActivityId.swift @@ -0,0 +1,3 @@ +import Foundation + +public typealias ActivityId = Int diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Types/CommunityBlockId.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Types/CommunityBlockId.swift deleted file mode 100644 index 9c14ba4..0000000 --- a/Sources/Lemmy-Swift-Client/Lemmy API/Types/CommunityBlockId.swift +++ /dev/null @@ -1,3 +0,0 @@ -import Foundation - -public typealias CommunityBlockId = Int diff --git a/Sources/Lemmy-Swift-Client/Lemmy API/Types/PaginationCursor.swift b/Sources/Lemmy-Swift-Client/Lemmy API/Types/PaginationCursor.swift new file mode 100644 index 0000000..6b39aa0 --- /dev/null +++ b/Sources/Lemmy-Swift-Client/Lemmy API/Types/PaginationCursor.swift @@ -0,0 +1,3 @@ +import Foundation + +public typealias PaginationCursor = String diff --git a/Sources/Lemmy-Swift-Client/Lemmy_Swift_Client.swift b/Sources/Lemmy-Swift-Client/Lemmy_Swift_Client.swift index 7897f53..f668abd 100644 --- a/Sources/Lemmy-Swift-Client/Lemmy_Swift_Client.swift +++ b/Sources/Lemmy-Swift-Client/Lemmy_Swift_Client.swift @@ -1,3 +1,4 @@ +import Combine import Foundation public enum LemmyAPIError: Error, CustomStringConvertible, LocalizedError { @@ -39,7 +40,7 @@ public class LemmyAPI { let mirror = Mirror(reflecting: apiRequest) request.url = request.url? .appending(queryItems: mirror.children.compactMap { label, value in - guard let label, + guard let label = label?.snakeCased(), let valueString = value as? CustomStringConvertible else { return nil } return URLQueryItem(name: label, value: String(describing: valueString)) @@ -70,6 +71,8 @@ public class LemmyAPI { // Decode Response let decoder = JSONDecoder() + decoder.keyDecodingStrategy = .convertFromSnakeCase + do { let decodedResult = try decoder.decode(T.Response.self, from: data) return (decodedResult, response, data) @@ -82,6 +85,33 @@ public class LemmyAPI { let (result, _, _) = try await baseRequest(apiRequest) return result } + + public func requestPublisher(_ apiRequest: T) + -> AnyPublisher + { + guard let request = try? urlRequest(apiRequest) + else { + return Fail(error: NSError(domain: "Could not complete the request", code: 400)) + .eraseToAnyPublisher() + } + + let decoder = JSONDecoder() + decoder.keyDecodingStrategy = .convertFromSnakeCase + + return URLSession + .shared + .dataTaskPublisher(for: request) + .tryMap { element -> Data in + guard let httpResponse = element.response as? HTTPURLResponse, + httpResponse.statusCode == 200 + else { + throw URLError(.badServerResponse) + } + return element.data + } + .decode(type: T.Response.self, decoder: decoder) + .eraseToAnyPublisher() + } } public enum HTTPMethod: String { diff --git a/Sources/Lemmy-Swift-Client/String+snakeCased.swift b/Sources/Lemmy-Swift-Client/String+snakeCased.swift new file mode 100644 index 0000000..804edb9 --- /dev/null +++ b/Sources/Lemmy-Swift-Client/String+snakeCased.swift @@ -0,0 +1,16 @@ +import Foundation + +extension String { + func snakeCased() -> String? { + let pattern = "([a-z0-9])([A-Z])" + + let regex = try? NSRegularExpression(pattern: pattern, options: []) + let range = NSRange(location: 0, length: count) + return regex?.stringByReplacingMatches( + in: self, + options: [], + range: range, + withTemplate: "$1_$2" + ).lowercased() + } +} diff --git a/autogen/index.js b/autogen/index.js index bbe23be..d0934d5 100644 --- a/autogen/index.js +++ b/autogen/index.js @@ -99,14 +99,14 @@ const fs = require("fs").promises; isOptional = true; } const type = tsToSwiftType(propertyName[2]) ?? propertyName[2]; - result += `\tpublic let ${name}: ${type}${isOptional ? "?" : ""}\n`; + result += `\tpublic let ${snakeToCamel(name)}: ${type}${isOptional ? "?" : ""}\n`; parsedProperties.push({ name, type, isOptional }); } result += ` public init( - ${parsedProperties.map((a) => `${a.name}: ${a.type}${a.isOptional ? "?" : ""}${a.isOptional ? " = nil" : ""}`).join(",\n\t\t")} + ${parsedProperties.map((a) => `${snakeToCamel(a.name)}: ${a.type}${a.isOptional ? "?" : ""}${a.isOptional ? " = nil" : ""}`).join(",\n\t\t")} ) { - ${parsedProperties.map((a) => `self.${a.name} = ${a.name}`).join("\n\t\t")} + ${parsedProperties.map((a) => `self.${snakeToCamel(a.name)} = ${snakeToCamel(a.name)}`).join("\n\t\t")} } `; result += "}\n"; @@ -140,8 +140,20 @@ function lowercaseFirstLetter(str) { return str.charAt(0).toLowerCase() + str.slice(1); } +function snakeToCamel(str) { + let converted = str.toLowerCase().replace(/([-_][a-z])/g, group => { + return group.toUpperCase().replace('-', '').replace('_', '') + }); + + if (converted.slice(-1) === "_") { + return converted.slice(0, -1); + } + + return converted +} + function tsToSwiftType(tsType) { - switch (tsType) { + switch (tsType.trim()) { case "string": return "String"; case "number":