diff --git a/Glpi.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Glpi.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Glpi.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Source/GlpiRequest.swift b/Source/GlpiRequest.swift index 9cc230a..641e2c5 100644 --- a/Source/GlpiRequest.swift +++ b/Source/GlpiRequest.swift @@ -247,6 +247,16 @@ public class GlpiRequest { } } + /** + Request list search option + */ + class public func listSearchOptions(itemType: ItemType, completion: @escaping (_ data: AnyObject?, _ response: HTTPURLResponse?, _ error: Error?) -> Void) { + + GlpiRequest.httpRequest(Routers.listSearchOptions(itemType)) { data, response, error in + completion(data, response, error) + } + } + class func httpRequest(_ router: Routers, completion: @escaping (_ data: AnyObject?, _ response: HTTPURLResponse?, _ error: Error?) -> Void) { let task:URLSessionDataTask = URLSession.shared.dataTask(with: router.request()) { (data, response, error) in diff --git a/Source/Routers.swift b/Source/Routers.swift index f77d4ac..bb84bca 100644 --- a/Source/Routers.swift +++ b/Source/Routers.swift @@ -67,6 +67,8 @@ public enum Routers: URLRequestDelegate { case deleteItems(ItemType, Int?, QueryString.DeleteItems?, [String: AnyObject]) /// PUT /lostPassword case lostPassword([String: AnyObject]) + /// GET /listSearchOptions + case listSearchOptions(ItemType) /// get HTTP Method var method: HTTPMethod { @@ -75,7 +77,7 @@ public enum Routers: URLRequestDelegate { .getMyEntities, .getActiveEntities, .getFullSession, .getGlpiConfig, .getMultipleItems, .getAllItems, .getItem, .getSubItems: return .get - case .changeActiveProfile, .changeActiveEntities, .addItems: + case .changeActiveProfile, .changeActiveEntities, .addItems, .listSearchOptions: return .post case .updateItems, .lostPassword: return .put @@ -132,6 +134,8 @@ public enum Routers: URLRequestDelegate { } case .lostPassword: return "/lostPassword" + case .listSearchOptions(let itemType): + return "/listSearchOptions/\(itemType)" } } @@ -141,7 +145,7 @@ public enum Routers: URLRequestDelegate { switch self { case .initSessionByUserToken, .initSessionByCredentials, .killSession, .getMyProfiles, .getActiveProfile, .changeActiveProfile, .getMyEntities, .getActiveEntities, .changeActiveEntities, - .getFullSession, .getGlpiConfig, .getMultipleItems, .addItems, .updateItems, .lostPassword: + .getFullSession, .getGlpiConfig, .getMultipleItems, .addItems, .updateItems, .lostPassword, .listSearchOptions: return nil case .getAllItems(_, let queryString): if queryString != nil {