Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit a5dfe35

Browse files
committed
Add ReaderStream enum
1 parent 05af184 commit a5dfe35

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ let package = Package(
1111
targets: [
1212
.binaryTarget(
1313
name: "WordPressKit",
14-
url: "https://github.com/user-attachments/files/17435861/WordPressKit.zip",
15-
checksum: "af7239442da8470a91ef5ab923fd91222bb3c0ea345b18f581bfafd63f0dd6b6"
14+
url: "https://github.com/user-attachments/files/17435956/WordPressKit.zip",
15+
checksum: "b3babe54d211d862e485ab3a742080dc9f2a5f04e2a6fa1d675545b0d00a795e"
1616
),
1717
]
1818
)

Sources/WordPressKit/Services/ReaderPostServiceRemote+Cards.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ public enum ReaderSortingOption: String, CaseIterable {
1111
}
1212
}
1313

14+
public enum ReaderStream: String {
15+
case discover = "discover"
16+
case firstPosts = "first-posts"
17+
}
18+
1419
extension ReaderPostServiceRemote {
1520
/// Returns a collection of RemoteReaderCard using the tags API
1621
/// a Reader Card can represent an item for the reader feed, such as
@@ -46,22 +51,22 @@ extension ReaderPostServiceRemote {
4651
/// - Topics you may like
4752
/// - Blogs you may like and so on
4853
///
49-
/// - Parameter stream: The name of the stream. By default, `discover`.
54+
/// - Parameter stream: The name of the stream. By default, `.discover`.
5055
/// - Parameter topics: an array of String representing the topics
5156
/// - Parameter page: a String that represents a page handle
5257
/// - Parameter sortingOption: a ReaderSortingOption that represents a sorting option
5358
/// - Parameter count: the number of cards to fetch. Warning: This also changes the number of objects returned for recommended sites/tags.
5459
/// - Parameter success: Called when the request succeeds and the data returned is valid
5560
/// - Parameter failure: Called if the request fails for any reason, or the response data is invalid
56-
public func fetchStreamCards(stream: String = "discover",
61+
public func fetchStreamCards(stream: ReaderStream = .discover,
5762
for topics: [String],
5863
page: String? = nil,
5964
sortingOption: ReaderSortingOption = .noSorting,
6065
refreshCount: Int? = nil,
6166
count: Int? = nil,
6267
success: @escaping ([RemoteReaderCard], String?) -> Void,
6368
failure: @escaping (Error) -> Void) {
64-
let path = "read/streams/\(stream)"
69+
let path = "read/streams/\(stream.rawValue)"
6570
guard let requestUrl = cardsEndpoint(with: path,
6671
topics: topics,
6772
page: page,

0 commit comments

Comments
 (0)