forked from shadowfacts/Tusker
Shadowfacts
d9b21a0196
Primarily in preparation for timeline position persistence and split timelines
32 lines
710 B
Swift
32 lines
710 B
Swift
//
|
|
// RequestRange.swift
|
|
// Pachyderm
|
|
//
|
|
// Created by Shadowfacts on 9/9/18.
|
|
// Copyright © 2018 Shadowfacts. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public enum RequestRange {
|
|
case `default`
|
|
case count(Int)
|
|
case before(id: String, count: Int?)
|
|
case after(id: String, count: Int?)
|
|
}
|
|
|
|
extension RequestRange {
|
|
var queryParameters: [Parameter] {
|
|
switch self {
|
|
case .default:
|
|
return []
|
|
case let .count(count):
|
|
return ["limit" => count]
|
|
case let .before(id, count):
|
|
return ["max_id" => id, "count" => count]
|
|
case let .after(id, count):
|
|
return ["min_id" => id, "count" => count]
|
|
}
|
|
}
|
|
}
|