diff --git a/README.md b/README.md index 1c1cd3b..2815125 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Using the wrapper is straight-forward: var cancellables = Set() apiClient - .recents() // <- Publisher + .recentsPublisher() // <- Publisher .sink( receiveCompletion: { _ in }, receiveValue: { print($0) } @@ -28,7 +28,7 @@ apiClient public protocol PostsAPI { /// Add a bookmark. - func add( + func addPublisher( url: URL, description: String, extended: String?, @@ -40,12 +40,12 @@ public protocol PostsAPI { ) -> AnyPublisher /// Delete a bookmark. - func delete( + func deletePublisher( url: URL ) -> AnyPublisher /// Returns one or more posts on a single day matching the arguments. - func get( + func getPublisher( tag: String?, dt: Date?, url: URL?, @@ -53,18 +53,18 @@ public protocol PostsAPI { ) -> AnyPublisher /// Returns a list of dates with the number of posts at each date. - func dates( + func datesPublisher( tag: String? ) -> AnyPublisher /// Returns a list of the user's most recent posts, filtered by tag. - func recents( + func recentsPublisher( tag: String?, count: Int? ) -> AnyPublisher /// Returns all bookmarks in the user's account. - func all( + func allPublisher( tag: String?, start: Int?, results: Int?, @@ -74,7 +74,7 @@ public protocol PostsAPI { ) -> AnyPublisher /// Returns a list of popular tags and recommended tags for a given URL. - func suggest( + func suggestPublisher( url: URL ) -> AnyPublisher } @@ -85,16 +85,16 @@ public protocol TagsAPI { /// Returns a full list of the user's tags along with the number of /// times they were used. - func get( + func getPublisher( ) -> AnyPublisher /// Delete an existing tag. - func delete( + func deletePublisher( tag: String ) -> AnyPublisher /// Rename a tag, or fold it in to an existing tag. - func rename( + func renamePublisher( old: String, new: String ) -> AnyPublisher @@ -107,7 +107,7 @@ public protocol UpdateAPI { /// Returns the most recent time a bookmark was added, updated or deleted. /// Use this before calling posts/all to see if the data has changed since /// the last fetch. - func update( + func updatePublisher( ) -> AnyPublisher } ``` diff --git a/Sources/PinboardKit/API/PostsAPI.swift b/Sources/PinboardKit/API/PostsAPI.swift index c306822..90c4401 100644 --- a/Sources/PinboardKit/API/PostsAPI.swift +++ b/Sources/PinboardKit/API/PostsAPI.swift @@ -4,7 +4,7 @@ import Combine public protocol PostsAPI { /// Add a bookmark. - func add( + func addPublisher( url: URL, description: String, extended: String?, @@ -16,12 +16,12 @@ public protocol PostsAPI { ) -> AnyPublisher /// Delete a bookmark. - func delete( + func deletePublisher( url: URL ) -> AnyPublisher /// Returns one or more posts on a single day matching the arguments. - func get( + func getPublisher( tag: String?, date: Date?, url: URL?, @@ -29,18 +29,18 @@ public protocol PostsAPI { ) -> AnyPublisher /// Returns a list of dates with the number of posts at each date. - func dates( + func datesPublisher( tag: String? ) -> AnyPublisher /// Returns a list of the user's most recent posts, filtered by tag. - func recents( + func recentsPublisher( tag: String?, count: Int? ) -> AnyPublisher /// Returns all bookmarks in the user's account. - func all( + func allPublisher( tag: String?, start: Int?, results: Int?, @@ -50,7 +50,7 @@ public protocol PostsAPI { ) -> AnyPublisher<[PostResponse], Error> /// Returns a list of popular tags and recommended tags for a given URL. - func suggest( + func suggestPublisher( url: URL ) -> AnyPublisher } @@ -59,7 +59,7 @@ extension PinboardAPI: PostsAPI { // MARK: - Public - public func add( + public func addPublisher( url: URL, description: String, extended: String? = nil, @@ -86,7 +86,7 @@ extension PinboardAPI: PostsAPI { .eraseToAnyPublisher() } - public func delete( + public func deletePublisher( url: URL ) -> AnyPublisher { networkClient @@ -95,7 +95,7 @@ extension PinboardAPI: PostsAPI { .eraseToAnyPublisher() } - public func get( + public func getPublisher( tag: String? = nil, date: Date? = nil, url: URL? = nil, @@ -114,7 +114,7 @@ extension PinboardAPI: PostsAPI { .eraseToAnyPublisher() } - public func dates( + public func datesPublisher( tag: String? = nil ) -> AnyPublisher { networkClient @@ -123,7 +123,7 @@ extension PinboardAPI: PostsAPI { .eraseToAnyPublisher() } - public func recents( + public func recentsPublisher( tag: String? = nil, count: Int? = nil ) -> AnyPublisher { @@ -133,7 +133,7 @@ extension PinboardAPI: PostsAPI { .eraseToAnyPublisher() } - public func all( + public func allPublisher( tag: String? = nil, start: Int? = nil, results: Int? = nil, @@ -156,7 +156,7 @@ extension PinboardAPI: PostsAPI { .eraseToAnyPublisher() } - public func suggest( + public func suggestPublisher( url: URL ) -> AnyPublisher { networkClient diff --git a/Sources/PinboardKit/API/TagsAPI.swift b/Sources/PinboardKit/API/TagsAPI.swift index 30f2212..ca2335f 100644 --- a/Sources/PinboardKit/API/TagsAPI.swift +++ b/Sources/PinboardKit/API/TagsAPI.swift @@ -5,16 +5,16 @@ public protocol TagsAPI { /// Returns a full list of the user's tags along with the number of /// times they were used. - func get( + func getPublisher( ) -> AnyPublisher /// Delete an existing tag. - func delete( + func deletePublisher( tag: String ) -> AnyPublisher /// Rename a tag, or fold it in to an existing tag. - func rename( + func renamePublisher( old: String, new: String ) -> AnyPublisher @@ -24,7 +24,7 @@ extension PinboardAPI: TagsAPI { // MARK: - Public - public func get( + public func getPublisher( ) -> AnyPublisher { networkClient .run(makeGetRequest()) @@ -32,7 +32,7 @@ extension PinboardAPI: TagsAPI { .eraseToAnyPublisher() } - public func delete( + public func deletePublisher( tag: String ) -> AnyPublisher { networkClient @@ -41,7 +41,7 @@ extension PinboardAPI: TagsAPI { .eraseToAnyPublisher() } - public func rename( + public func renamePublisher( old: String, new: String ) -> AnyPublisher { diff --git a/Sources/PinboardKit/API/UpdateAPI.swift b/Sources/PinboardKit/API/UpdateAPI.swift index 823e430..2fe0a47 100644 --- a/Sources/PinboardKit/API/UpdateAPI.swift +++ b/Sources/PinboardKit/API/UpdateAPI.swift @@ -6,7 +6,7 @@ public protocol UpdateAPI { /// Returns the most recent time a bookmark was added, updated or deleted. /// Use this before calling posts/all to see if the data has changed since /// the last fetch. - func update( + func updatePublisher( ) -> AnyPublisher } @@ -16,7 +16,7 @@ extension PinboardAPI: UpdateAPI { // MARK: - Public - public func update( + public func updatePublisher( ) -> AnyPublisher { networkClient .run(makeUpdateRequest())