Skip to content

Commit

Permalink
Merge development into main
Browse files Browse the repository at this point in the history
  • Loading branch information
sbertix committed Dec 13, 2020
2 parents 21069a5 + eca0564 commit ca40e23
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Sources/Swiftagram/Endpoints/EndpointFriendship.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ public extension Endpoint {
///
/// - parameters:
/// - identifier: A `String` holding reference to a valid user identifier.
/// - query: An optional `String` representing a username or name component to query following. Defaults to `nil`.
/// - page: An optional `String` holding reference to a valid cursor. Defaults to `nil`.
/// - note: This is equal to the user's **following**.
public static func followed(by identifier: String, startingAt page: String? = nil) -> Paginated<Swiftagram.User.Collection> {
public static func followed(by identifier: String,
matching query: String? = nil,
startingAt page: String? = nil) -> Paginated<Swiftagram.User.Collection> {
base.appending(path: identifier)
.following
.appending(query: "q", with: query)
.paginating(process: Swiftagram.User.Collection.self, value: page)
.locking(Secret.self)
}
Expand All @@ -32,13 +36,16 @@ public extension Endpoint {
///
/// - parameters:
/// - identifier: A `String` holding reference to a valid user identifier.
/// - query: An optional `String` representing a username or name component to query followers. Defaults to `nil`.
/// - page: An optional `String` holding reference to a valid cursor. Defaults to `nil`.
/// - note: This is equal to the user's **followers**.
public static func following(_ identifier: String, startingAt page: String? = nil) -> Paginated<Swiftagram.User.Collection> {
public static func following(_ identifier: String,
matching query: String? = nil,
startingAt page: String? = nil) -> Paginated<Swiftagram.User.Collection> {
base.appending(path: identifier)
.followers
.paginating(process: Swiftagram.User.Collection.self,
value: page)
.appending(query: "q", with: query)
.paginating(process: Swiftagram.User.Collection.self, value: page)
.locking(Secret.self)
}

Expand Down
2 changes: 2 additions & 0 deletions Tests/SwiftagramTests/EndpointTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ final class EndpointTests: XCTestCase {
func testEndpointFriendship() {
performTest(on: Endpoint.Friendship.followed(by: "183250726"))
performTest(on: Endpoint.Friendship.following("183250726"))
performTest(on: Endpoint.Friendship.followed(by: "183250726", matching: "a"))
performTest(on: Endpoint.Friendship.following("183250726", matching: "a"))
performTest(on: Endpoint.Friendship.summary(for: "25025320"))
performTest(on: Endpoint.Friendship.summary(for: ["25025320"]))
performTest(on: Endpoint.Friendship.pendingRequests())
Expand Down

0 comments on commit ca40e23

Please sign in to comment.