Skip to content
This repository has been archived by the owner on Jul 21, 2020. It is now read-only.

Commit

Permalink
Implement sorting into the correct endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
jackcook committed Aug 4, 2016
1 parent c46ef7d commit ff881d7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions BeamAPI.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "BeamAPI"
s.version = "1.0.4"
s.version = "1.0.5"
s.summary = "An interface to communicate with Beam's backend."
s.homepage = "https://github.com/WatchBeam/beam-client-swift"
s.license = "MIT"
Expand All @@ -9,7 +9,7 @@ Pod::Spec.new do |s|
s.requires_arc = true
s.ios.deployment_target = "8.2"
s.tvos.deployment_target = "9.0"
s.source = { :git => "https://github.com/WatchBeam/beam-client-swift.git", :tag => "1.0.4" }
s.source = { :git => "https://github.com/WatchBeam/beam-client-swift.git", :tag => "1.0.5" }
s.source_files = "Pod/Classes/**/*"

s.dependency "Starscream", "~> 1.1"
Expand Down
2 changes: 1 addition & 1 deletion Example/Tests/UsersTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class UsersTests: XCTestCase {
func testUserFollowedChannels() {
let expectation = expectationWithDescription("tests retreving a user's followed channels")

BeamClient.sharedClient.users.getFollowedChannelsByUser(userId) { (channels, error) in
BeamClient.sharedClient.users.getFollowedChannelsByUser(userId, page: 0) { (channels, error) in
XCTAssertNotNil(channels)
XCTAssertNil(error)
expectation.fulfill()
Expand Down
2 changes: 1 addition & 1 deletion Pod/Classes/Routes/ChannelsRoutes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public class ChannelsRoutes {
:param: completion An optional copmletion block with the retrieved followers' data.
*/
public func getFollowersOfChannel(id: Int, page: Int = 0, completion: ((users: [BeamUser]?, error: BeamRequestError?) -> Void)?) {
var params = ["order": "online:desc,viewersCurrent:desc,viewersTotal:desc", "where": "suspended.eq.0", "page": "\(page)"]
var params = ["page": "\(page)"]

BeamRequest.request("/channels/\(id)/follow", params: params) { (json, error) in
guard let users = json?.array else {
Expand Down
4 changes: 3 additions & 1 deletion Pod/Classes/Routes/UsersRoutes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ public class UsersRoutes {
:param: id The id of the user whose followed channels are being retrieved.
:param: completion An optional completion block with retrieved channels' data.
*/
public func getFollowedChannelsByUser(id: Int, completion: ((channels: [BeamChannel]?, error: BeamRequestError?) -> Void)?) {
public func getFollowedChannelsByUser(id: Int, page: Int, completion: ((channels: [BeamChannel]?, error: BeamRequestError?) -> Void)?) {
var params = ["order": "online:desc,viewersCurrent:desc,viewersTotal:desc", "where": "suspended.eq.0", "page": "\(page)"]

BeamRequest.request("/users/\(id)/follows") { (json, error) in
guard let channels = json?.array else {
completion?(channels: nil, error: error)
Expand Down

0 comments on commit ff881d7

Please sign in to comment.