0001 // 0002 // PeliasSearchConfigObject.swift 0003 // PlayMap 0004 // 0005 // Created by Matt on 11/24/15. 0006 // Copyright © 2015 Mapzen. All rights reserved. 0007 // 0008 0009 import Foundation 0010 0011 public struct PeliasSearchConfig: SearchAPIConfigData { 0012 0013 var urlEndpoint = NSURL.init(string: "/v1/search", relativeToURL: PeliasSearchManager.sharedInstance.baseUrl)! 0014 0015 var searchText
PeliasSearchManager.swift:29 public func performSearch(config: PeliasSearchConfig) -> PeliasOperation {: String{ 0016 didSet { 0017 appendQueryItem("text", value: searchText) 0018 } 0019 } 0020 0021 var queryItems = [String:NSURLQueryItem]() 0022 0023 var completionHandler
PeliasSearchConfigObject.swift:17 appendQueryItem("text", value: searchText)PeliasSearchConfigObject.swift:98 self.searchText = searchText: (PeliasResponse) -> Void 0024 0025 var apiKey
PeliasSearchConfigObject.swift:99 self.completionHandler = completionHandler: String? { 0026 didSet { 0027 if let key = apiKey where apiKey?.isEmpty == false { 0028 appendQueryItem("api_key", value: key) 0029 } 0030 } 0031 } 0032 0033 //Optional Query Params 0034 0035 var numberOfResults
PeliasSearchConfigObject.swift:27 if let key = apiKey where apiKey?.isEmpty == false {PeliasSearchConfigObject.swift:27 if let key = apiKey where apiKey?.isEmpty == false {PeliasSearchConfigObject.swift:100 apiKey = PeliasSearchManager.sharedInstance.apiKeyPeliasSearchConfigObject.swift:104 appendQueryItem("api_key", value: apiKey): Int? { 0036 didSet { 0037 if let size = numberOfResults where numberOfResults > 0 { 0038 appendQueryItem("size", value: String(size)) 0039 } 0040 } 0041 } 0042 0043 var boundaryCountry
PeliasSearchConfigObject.swift:37 if let size = numberOfResults where numberOfResults > 0 {PeliasSearchConfigObject.swift:37 if let size = numberOfResults where numberOfResults > 0 {: String? { 0044 didSet { 0045 if let country = boundaryCountry where boundaryCountry?.isEmpty == false{ 0046 appendQueryItem("boundary.country", value: country) 0047 } 0048 } 0049 } 0050 0051 var boundaryRect
PeliasSearchConfigObject.swift:45 if let country = boundaryCountry where boundaryCountry?.isEmpty == false{PeliasSearchConfigObject.swift:45 if let country = boundaryCountry where boundaryCountry?.isEmpty == false{: SearchBoundaryRect? { 0052 didSet { 0053 if let rect = boundaryRect { 0054 appendQueryItem("boundary.rect.min_lat", value: String(rect.minLatLong.latitude)) 0055 appendQueryItem("boundary.rect.min_lon", value: String(rect.minLatLong.longitude)) 0056 appendQueryItem("boundary.rect.max_lat", value: String(rect.maxLatLong.latitude)) 0057 appendQueryItem("boundary.rect.max_lon", value: String(rect.maxLatLong.longitude)) 0058 } 0059 } 0060 } 0061 0062 var boundaryCircle
PeliasSearchConfigObject.swift:53 if let rect = boundaryRect {: SearchBoundaryCircle? { 0063 didSet { 0064 if let circle = boundaryCircle { 0065 appendQueryItem("boundary.cirle.lat", value: String(circle.center.latitude)) 0066 appendQueryItem("boundary.circle.lon", value: String(circle.center.longitude)) 0067 appendQueryItem("boundary.circle.radius", value: String(circle.radius)) 0068 } 0069 } 0070 } 0071 0072 var focusPoint
PeliasSearchConfigObject.swift:64 if let circle = boundaryCircle {: GeoPoint? { 0073 didSet { 0074 if let point = focusPoint { 0075 appendQueryItem("focus.point.lat", value: String(point.latitude)) 0076 appendQueryItem("focus.point.lon", value: String(point.longitude)) 0077 } 0078 } 0079 } 0080 0081 var dataSources
PeliasSearchConfigObject.swift:74 if let point = focusPoint {: [SearchSource]? { 0082 didSet { 0083 if let sources = dataSources where dataSources?.isEmpty == false { 0084 appendQueryItem("sources", value: SearchSource.dataSourceString(sources)) 0085 } 0086 } 0087 } 0088 0089 var layers
PeliasSearchConfigObject.swift:83 if let sources = dataSources where dataSources?.isEmpty == false {PeliasSearchConfigObject.swift:83 if let sources = dataSources where dataSources?.isEmpty == false {: [LayerFilter]? { 0090 didSet { 0091 if let layerArray = layers where layers?.isEmpty == false { 0092 appendQueryItem("layers", value: LayerFilter.layerString(layerArray)) 0093 } 0094 } 0095 } 0096 0097 init(searchText: String, completionHandler: (PeliasResponse) -> Void){ 0098 self.searchText = searchText 0099 self.completionHandler = completionHandler 0100 apiKey = PeliasSearchManager.sharedInstance.apiKey 0101 defer { 0102 //didSet will not fire because self is not setup so we have to do this manually 0103 appendQueryItem("text", value: searchText) 0104 appendQueryItem("api_key", value: apiKey) 0105 } 0106 } 0107 }
PeliasSearchConfigObject.swift:91 if let layerArray = layers where layers?.isEmpty == false {PeliasSearchConfigObject.swift:91 if let layerArray = layers where layers?.isEmpty == false {