Skip to content

Commit 3a5c175

Browse files
authoredJul 3, 2023
Improving Lemmy 0.18.0 support (#34)
1 parent a8c8ceb commit 3a5c175

36 files changed

+127
-122
lines changed
 

‎Sources/Lemmy-Swift-Client/Lemmy API/Enums/ListingType.swift

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ public enum ListingType: String, Codable, CustomStringConvertible, CaseIterable
44
case all = "All"
55
case local = "Local"
66
case subscribed = "Subscribed"
7-
case community = "Community"
87

98
public var description: String {
109
return rawValue

‎Sources/Lemmy-Swift-Client/Lemmy API/Enums/SortType.swift

+14-8
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,30 @@ public enum SortType: String, Codable, CustomStringConvertible, CaseIterable {
66
case active = "Active"
77
/// Posts sorted by a decaying rank.
88
case hot = "Hot"
9-
/// Posts sorted by the most comments.
10-
case mostComments = "MostComments"
119
/// Posts sorted by the published time.
1210
case new = "New"
13-
/// Posts sorted by the newest comments, with no necrobumping. IE a forum sort.
14-
case newComments = "NewComments"
1511
/// Posts sorted by the published time ascending
1612
case old = "Old"
17-
/// The top posts of all time.
18-
case topAll = "TopAll"
1913
/// The top posts for this last day.
2014
case topDay = "TopDay"
21-
/// The top posts for this last month.
22-
case topMonth = "TopMonth"
2315
/// The top posts for this last week.
2416
case topWeek = "TopWeek"
17+
/// The top posts for this last month.
18+
case topMonth = "TopMonth"
2519
/// The top posts for this last year.
2620
case topYear = "TopYear"
21+
/// The top posts of all time.
22+
case topAll = "TopAll"
23+
/// Posts sorted by the most comments.
24+
case mostComments = "MostComments"
25+
/// Posts sorted by the newest comments, with no necrobumping. IE a forum sort.
26+
case newComments = "NewComments"
27+
/// The top posts for this last hour.
28+
case topHour = "TopHour"
29+
/// The top posts for this last six hour.
30+
case topSixHour = "TopSixHour"
31+
/// The top posts for this last six hour.
32+
case topTwelveHour = "TopTwelveHour"
2733

2834
public var description: String {
2935
return rawValue

‎Sources/Lemmy-Swift-Client/Lemmy API/Requests/SaveUserSettings.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ public struct SaveUserSettingsRequest: APIRequest {
1111
public let banner: String?
1212
public let bio: String?
1313
public let bot_account: Bool?
14-
public let default_listing_type: Int?
15-
public let default_sort_type: Int?
14+
public let default_listing_type: ListingType?
15+
public let default_sort_type: SortType?
1616
public let discussion_languages: [Int]?
1717
public let display_name: String?
1818
public let email: String?
@@ -33,8 +33,8 @@ public struct SaveUserSettingsRequest: APIRequest {
3333
banner: String? = nil,
3434
bio: String? = nil,
3535
bot_account: Bool? = nil,
36-
default_listing_type: Int? = nil,
37-
default_sort_type: Int? = nil,
36+
default_listing_type: ListingType? = nil,
37+
default_sort_type: SortType? = nil,
3838
discussion_languages: [Int]? = nil,
3939
display_name: String? = nil,
4040
email: String? = nil,

‎Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgeCommentView.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import Foundation
22

33
public struct AdminPurgeCommentView: Codable {
4-
public let admin: PersonSafe?
4+
public let admin: Person?
55
public let admin_purge_comment: AdminPurgeComment
66
public let post: Post
77

8-
public init(admin: PersonSafe? = nil, admin_purge_comment: AdminPurgeComment, post: Post) {
8+
public init(admin: Person? = nil, admin_purge_comment: AdminPurgeComment, post: Post) {
99
self.admin = admin
1010
self.admin_purge_comment = admin_purge_comment
1111
self.post = post

‎Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgeCommunityView.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import Foundation
22

33
public struct AdminPurgeCommunityView: Codable {
4-
public let admin: PersonSafe?
4+
public let admin: Person?
55
public let admin_purge_community: AdminPurgeCommunity
66

7-
public init(admin: PersonSafe? = nil, admin_purge_community: AdminPurgeCommunity) {
7+
public init(admin: Person? = nil, admin_purge_community: AdminPurgeCommunity) {
88
self.admin = admin
99
self.admin_purge_community = admin_purge_community
1010
}

‎Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgePersonView.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import Foundation
22

33
public struct AdminPurgePersonView: Codable {
4-
public let admin: PersonSafe?
4+
public let admin: Person?
55
public let admin_purge_person: AdminPurgePerson
66

7-
public init(admin: PersonSafe? = nil, admin_purge_person: AdminPurgePerson) {
7+
public init(admin: Person? = nil, admin_purge_person: AdminPurgePerson) {
88
self.admin = admin
99
self.admin_purge_person = admin_purge_person
1010
}

‎Sources/Lemmy-Swift-Client/Lemmy API/Structs/AdminPurgePostView.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import Foundation
22

33
public struct AdminPurgePostView: Codable {
4-
public let admin: PersonSafe?
4+
public let admin: Person?
55
public let admin_purge_post: AdminPurgePost
66
public let community: CommunitySafe
77

8-
public init(admin: PersonSafe? = nil, admin_purge_post: AdminPurgePost, community: CommunitySafe) {
8+
public init(admin: Person? = nil, admin_purge_post: AdminPurgePost, community: CommunitySafe) {
99
self.admin = admin
1010
self.admin_purge_post = admin_purge_post
1111
self.community = community

‎Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentReplyView.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ public struct CommentReplyView: Codable {
55
public let comment_reply: CommentReply
66
public let community: CommunitySafe
77
public let counts: CommentAggregates
8-
public let creator: PersonSafe
8+
public let creator: Person
99
public let creator_banned_from_community: Bool
1010
public let creator_blocked: Bool
1111
public let my_vote: Int?
1212
public let post: Post
13-
public let recipient: PersonSafe
13+
public let recipient: Person
1414
public let saved: Bool
1515
public let subscribed: SubscribedType
1616

@@ -19,12 +19,12 @@ public struct CommentReplyView: Codable {
1919
comment_reply: CommentReply,
2020
community: CommunitySafe,
2121
counts: CommentAggregates,
22-
creator: PersonSafe,
22+
creator: Person,
2323
creator_banned_from_community: Bool,
2424
creator_blocked: Bool,
2525
my_vote: Int? = nil,
2626
post: Post,
27-
recipient: PersonSafe,
27+
recipient: Person,
2828
saved: Bool,
2929
subscribed: SubscribedType
3030
) {

‎Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentReportView.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@ import Foundation
22

33
public struct CommentReportView: Codable {
44
public let comment: Comment
5-
public let comment_creator: PersonSafe
5+
public let comment_creator: Person
66
public let comment_report: CommentReport
77
public let community: CommunitySafe
88
public let counts: CommentAggregates
9-
public let creator: PersonSafe
9+
public let creator: Person
1010
public let creator_banned_from_community: Bool
1111
public let my_vote: Int?
1212
public let post: Post
13-
public let resolver: PersonSafe?
13+
public let resolver: Person?
1414

1515
public init(
1616
comment: Comment,
17-
comment_creator: PersonSafe,
17+
comment_creator: Person,
1818
comment_report: CommentReport,
1919
community: CommunitySafe,
2020
counts: CommentAggregates,
21-
creator: PersonSafe,
21+
creator: Person,
2222
creator_banned_from_community: Bool,
2323
my_vote: Int? = nil,
2424
post: Post,
25-
resolver: PersonSafe? = nil
25+
resolver: Person? = nil
2626
) {
2727
self.comment = comment
2828
self.comment_creator = comment_creator

‎Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommentView.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ public struct CommentView: Codable {
44
public let comment: Comment
55
public let community: CommunitySafe
66
public let counts: CommentAggregates
7-
public let creator: PersonSafe
7+
public let creator: Person
88
public let creator_banned_from_community: Bool
99
public let creator_blocked: Bool
1010
public let my_vote: Int?
@@ -16,7 +16,7 @@ public struct CommentView: Codable {
1616
comment: Comment,
1717
community: CommunitySafe,
1818
counts: CommentAggregates,
19-
creator: PersonSafe,
19+
creator: Person,
2020
creator_banned_from_community: Bool,
2121
creator_blocked: Bool,
2222
my_vote: Int? = nil,

‎Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommunityBlockView.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import Foundation
22

33
public struct CommunityBlockView: Codable {
44
public let community: CommunitySafe
5-
public let person: PersonSafe
5+
public let person: Person
66

7-
public init(community: CommunitySafe, person: PersonSafe) {
7+
public init(community: CommunitySafe, person: Person) {
88
self.community = community
99
self.person = person
1010
}

‎Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommunityFolowerView.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import Foundation
22

33
public struct CommunityFolowerView: Codable {
44
public let community: CommunitySafe
5-
public let follower: PersonSafe
5+
public let follower: Person
66

7-
public init(community: CommunitySafe, follower: PersonSafe) {
7+
public init(community: CommunitySafe, follower: Person) {
88
self.community = community
99
self.follower = follower
1010
}

‎Sources/Lemmy-Swift-Client/Lemmy API/Structs/CommunityModeratorView.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import Foundation
22

33
public struct CommunityModeratorView: Codable {
44
public let community: CommunitySafe
5-
public let moderator: PersonSafe
5+
public let moderator: Person
66

7-
public init(community: CommunitySafe, moderator: PersonSafe) {
7+
public init(community: CommunitySafe, moderator: Person) {
88
self.community = community
99
self.moderator = moderator
1010
}

‎Sources/Lemmy-Swift-Client/Lemmy API/Structs/LocalUserSettings.swift ‎Sources/Lemmy-Swift-Client/Lemmy API/Structs/LocalUser.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import Foundation
22

3-
public struct LocalUserSettings: Codable {
3+
public struct LocalUser: Codable {
44
public let accepted_application: Bool
5-
public let default_listing_type: Int
6-
public let default_sort_type: Int
5+
public let default_listing_type: ListingType
6+
public let default_sort_type: SortType
77
public let email: String?
88
public let email_verified: Bool
99
public let id: Int
@@ -21,8 +21,8 @@ public struct LocalUserSettings: Codable {
2121

2222
public init(
2323
accepted_application: Bool,
24-
default_listing_type: Int,
25-
default_sort_type: Int,
24+
default_listing_type: ListingType,
25+
default_sort_type: SortType,
2626
email: String? = nil,
2727
email_verified: Bool,
2828
id: Int,

‎Sources/Lemmy-Swift-Client/Lemmy API/Structs/LocalUserSettingsView.swift

-13
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import Foundation
2+
3+
public struct LocalUserView: Codable {
4+
public let counts: PersonAggregates
5+
public let local_user: LocalUser
6+
public let person: Person
7+
8+
public init(counts: PersonAggregates, local_user: LocalUser, person: Person) {
9+
self.counts = counts
10+
self.local_user = local_user
11+
self.person = person
12+
}
13+
}

‎Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModAddCommunityView.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import Foundation
33
public struct ModAddCommunityView: Codable {
44
public let community: CommunitySafe
55
public let mod_add_community: ModAddCommunity
6-
public let modded_person: PersonSafe
7-
public let moderator: PersonSafe
6+
public let modded_person: Person
7+
public let moderator: Person
88

99
public init(
1010
community: CommunitySafe,
1111
mod_add_community: ModAddCommunity,
12-
modded_person: PersonSafe,
13-
moderator: PersonSafe
12+
modded_person: Person,
13+
moderator: Person
1414
) {
1515
self.community = community
1616
self.mod_add_community = mod_add_community

‎Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModAddView.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import Foundation
22

33
public struct ModAddView: Codable {
44
public let mod_add: ModAdd
5-
public let modded_person: PersonSafe
6-
public let moderator: PersonSafe?
5+
public let modded_person: Person
6+
public let moderator: Person?
77

8-
public init(mod_add: ModAdd, modded_person: PersonSafe, moderator: PersonSafe? = nil) {
8+
public init(mod_add: ModAdd, modded_person: Person, moderator: Person? = nil) {
99
self.mod_add = mod_add
1010
self.modded_person = modded_person
1111
self.moderator = moderator

‎Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModBanFromCommunityView.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import Foundation
22

33
public struct ModBanFromCommunityView: Codable {
4-
public let banned_person: PersonSafe
4+
public let banned_person: Person
55
public let community: CommunitySafe
66
public let mod_ban_from_community: ModBanFromCommunity
7-
public let moderator: PersonSafe?
7+
public let moderator: Person?
88

99
public init(
10-
banned_person: PersonSafe,
10+
banned_person: Person,
1111
community: CommunitySafe,
1212
mod_ban_from_community: ModBanFromCommunity,
13-
moderator: PersonSafe? = nil
13+
moderator: Person? = nil
1414
) {
1515
self.banned_person = banned_person
1616
self.community = community

‎Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModBanView.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import Foundation
22

33
public struct ModBanView: Codable {
4-
public let banned_person: PersonSafe
4+
public let banned_person: Person
55
public let mod_ban: ModBan
6-
public let moderator: PersonSafe?
6+
public let moderator: Person?
77

8-
public init(banned_person: PersonSafe, mod_ban: ModBan, moderator: PersonSafe? = nil) {
8+
public init(banned_person: Person, mod_ban: ModBan, moderator: Person? = nil) {
99
self.banned_person = banned_person
1010
self.mod_ban = mod_ban
1111
self.moderator = moderator

‎Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModFeaturePostView.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import Foundation
33
public struct ModFeaturePostView: Codable {
44
public let community: CommunitySafe
55
public let mod_feature_post: ModFeaturePost
6-
public let moderator: PersonSafe?
6+
public let moderator: Person?
77
public let post: Post
88

99
public init(
1010
community: CommunitySafe,
1111
mod_feature_post: ModFeaturePost,
12-
moderator: PersonSafe? = nil,
12+
moderator: Person? = nil,
1313
post: Post
1414
) {
1515
self.community = community

‎Sources/Lemmy-Swift-Client/Lemmy API/Structs/ModLockPostView.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import Foundation
33
public struct ModLockPostView: Codable {
44
public let community: CommunitySafe
55
public let mod_lock_post: ModLockPost
6-
public let moderator: PersonSafe?
6+
public let moderator: Person?
77
public let post: Post
88

99
public init(
1010
community: CommunitySafe,
1111
mod_lock_post: ModLockPost,
12-
moderator: PersonSafe? = nil,
12+
moderator: Person? = nil,
1313
post: Post
1414
) {
1515
self.community = community

0 commit comments

Comments
 (0)
Please sign in to comment.