Skip to content

Commit 3a5c175

Browse files
authored
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 14 additions & 8 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 6 additions & 6 deletions
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

Lines changed: 2 additions & 2 deletions
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,

0 commit comments

Comments
 (0)