Skip to content

Commit

Permalink
Update Reader APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Oct 18, 2024
1 parent c3eeb90 commit 05af184
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ let package = Package(
targets: [
.binaryTarget(
name: "WordPressKit",
url: "https://github.com/user-attachments/files/16531883/WordPressKit.zip",
checksum: "ca916824c64a6061814a69a37bc9a6560aafcc35559983e945fdfa5c3bbcc23d"
url: "https://github.com/user-attachments/files/17435861/WordPressKit.zip",
checksum: "af7239442da8470a91ef5ab923fd91222bb3c0ea345b18f581bfafd63f0dd6b6"
),
]
)
5 changes: 4 additions & 1 deletion Sources/WordPressKit/Models/RemoteReaderPost.m
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ - (instancetype)initWithDictionary:(NSDictionary *)dict;
self.authorDisplayName = [[self stringOrEmptyString:[authorDict stringForKey:PostRESTKeyName]] wpkit_stringByDecodingXMLCharacters]; // Typically the author's given name
self.authorEmail = [self authorEmailFromAuthorDictionary:authorDict];
self.authorURL = [self stringOrEmptyString:[authorDict stringForKey:PostRESTKeyURL]];
self.siteIconURL = [self stringOrEmptyString:[dict stringForKeyPath:@"meta.data.site.icon.img"]];
self.siteIconURL = [self stringOrEmptyString:[dict stringForKeyPath:@"site_icon.img"]];
if (self.siteIconURL.length == 0) {
self.siteIconURL = [self stringOrEmptyString:[dict stringForKeyPath:@"meta.data.site.icon.img"]];
}
self.blogName = [self siteNameFromPostDictionary:dict];
self.blogDescription = [self siteDescriptionFromPostDictionary:dict];
self.blogURL = [self siteURLFromPostDictionary:dict];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,22 @@ extension ReaderPostServiceRemote {
/// - Topics you may like
/// - Blogs you may like and so on
///
/// - Parameter stream: The name of the stream. By default, `discover`.
/// - Parameter topics: an array of String representing the topics
/// - Parameter page: a String that represents a page handle
/// - Parameter sortingOption: a ReaderSortingOption that represents a sorting option
/// - Parameter count: the number of cards to fetch. Warning: This also changes the number of objects returned for recommended sites/tags.
/// - Parameter success: Called when the request succeeds and the data returned is valid
/// - Parameter failure: Called if the request fails for any reason, or the response data is invalid
public func fetchStreamCards(for topics: [String],
public func fetchStreamCards(stream: String = "discover",
for topics: [String],
page: String? = nil,
sortingOption: ReaderSortingOption = .noSorting,
refreshCount: Int? = nil,
count: Int? = nil,
success: @escaping ([RemoteReaderCard], String?) -> Void,
failure: @escaping (Error) -> Void) {
let path = "read/streams/discover"
let path = "read/streams/\(stream)"
guard let requestUrl = cardsEndpoint(with: path,
topics: topics,
page: page,
Expand Down

0 comments on commit 05af184

Please sign in to comment.