Tusker/Pachyderm/Request/RequestRange.swift

32 lines
710 B
Swift
Raw Normal View History

2018-09-11 14:52:21 +00:00
//
// 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]
2018-09-11 14:52:21 +00:00
}
}
}