Tusker/Pachyderm/Request/RequestRange.swift
Shadowfacts d9b21a0196
Represent timelines internally as segments
Primarily in preparation for timeline position persistence and split
timelines
2019-07-31 17:42:19 -06:00

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]
}
}
}