jellyfin-sdk-swift/Sources/Paths/GetUsersAPI.swift

26 lines
892 B
Swift
Raw Permalink Normal View History

2022-08-08 20:29:07 +00:00
//
2022-08-16 02:37:47 +00:00
// jellyfin-sdk-swift is subject to the terms of the Mozilla Public
2022-08-08 20:29:07 +00:00
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
2024-02-19 03:34:53 +00:00
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
2022-08-08 20:29:07 +00:00
//
2022-08-08 20:21:06 +00:00
import Foundation
import Get
import URLQueryEncoder
extension Paths {
/// Gets a list of users.
2022-08-17 21:08:41 +00:00
public static func getUsers(isHidden: Bool? = nil, isDisabled: Bool? = nil) -> Request<[JellyfinAPI.UserDto]> {
2023-08-30 22:09:52 +00:00
Request(path: "/Users", method: "GET", query: makeGetUsersQuery(isHidden, isDisabled), id: "GetUsers")
2022-08-08 20:21:06 +00:00
}
private static func makeGetUsersQuery(_ isHidden: Bool?, _ isDisabled: Bool?) -> [(String, String?)] {
let encoder = URLQueryEncoder()
encoder.encode(isHidden, forKey: "isHidden")
encoder.encode(isDisabled, forKey: "isDisabled")
return encoder.items
}
}