|
| 1 | +// |
| 2 | +/* |
| 3 | + * Copyright © 2017 Teclib. All rights reserved. |
| 4 | + * |
| 5 | + * QueryGetAllItems.swift is part of Glpi |
| 6 | + * |
| 7 | + * Glpi is a subproject of Flyve MDM. Flyve MDM is a mobile |
| 8 | + * device management software. |
| 9 | + * |
| 10 | + * Glpi is Licensed under the Apache License, Version 2.0 (the "License"); |
| 11 | + * you may not use this file except in compliance with the License. |
| 12 | + * You may obtain a copy of the License at |
| 13 | + * |
| 14 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 15 | + * |
| 16 | + * Unless required by applicable law or agreed to in writing, software |
| 17 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 18 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 19 | + * See the License for the specific language governing permissions and |
| 20 | + * limitations under the License. |
| 21 | + * ------------------------------------------------------------------------------ |
| 22 | + * @author Hector Rondon |
| 23 | + * @date 24/10/17 |
| 24 | + * @copyright Copyright © 2017 Teclib. All rights reserved. |
| 25 | + * @license Apache License, Version 2.0 https://www.apache.org/licenses/LICENSE-2.0 |
| 26 | + * @link https://github.com/flyve-mdm/[name] |
| 27 | + * @link https://flyve-mdm.com |
| 28 | + * ------------------------------------------------------------------------------ |
| 29 | + */ |
| 30 | + |
| 31 | + |
| 32 | +import Foundation |
| 33 | + |
| 34 | +public enum orderType { |
| 35 | + case ASC |
| 36 | + case DESC |
| 37 | +} |
| 38 | + |
| 39 | +public struct QueryGetAllItems { |
| 40 | + public var expandDropdowns: Bool? |
| 41 | + public var getHateoas: Bool? |
| 42 | + public var onlyId: Bool? |
| 43 | + public var range: String? |
| 44 | + public var sort: Int? |
| 45 | + public var order: orderType? |
| 46 | + public var searchText: String? |
| 47 | + public var isDeleted: Bool? |
| 48 | + |
| 49 | + public init() {} |
| 50 | + |
| 51 | + var queryString: [String: AnyObject] { |
| 52 | + get { |
| 53 | + var query = [String: AnyObject]() |
| 54 | + if expandDropdowns != nil { |
| 55 | + query["expand_dropdowns"] = expandDropdowns as AnyObject |
| 56 | + } |
| 57 | + if getHateoas != nil { |
| 58 | + query["get_hateoas"] = getHateoas as AnyObject |
| 59 | + } |
| 60 | + if onlyId != nil { |
| 61 | + query["only_id"] = onlyId as AnyObject |
| 62 | + } |
| 63 | + if range != nil { |
| 64 | + query["range"] = range as AnyObject |
| 65 | + } |
| 66 | + if sort != nil { |
| 67 | + query["sort"] = sort as AnyObject |
| 68 | + } |
| 69 | + if order != nil { |
| 70 | + query["order"] = order as AnyObject |
| 71 | + } |
| 72 | + if searchText != nil { |
| 73 | + query["searchText"] = searchText as AnyObject |
| 74 | + } |
| 75 | + if isDeleted != nil { |
| 76 | + query["is_deleted"] = isDeleted as AnyObject |
| 77 | + } |
| 78 | + return query |
| 79 | + } |
| 80 | + } |
| 81 | +} |
0 commit comments