@@ -109,15 +109,15 @@ public class Client {
109109 /// :return: JSON Object in the block in the form:
110110 /// { "items": [ {"name": "contacts", "createdAt": "2013-01-18T15:33:13.556Z"},
111111 /// {"name": "notes", "createdAt": "2013-01-18T15:33:13.556Z"}]}
112- public func listIndexes( block: CompletionHandlerType ? ) {
112+ public func listIndexes( block: CompletionHandlerType ? = nil ) {
113113 performHTTPQuery ( " 1/indexes " , method: . GET, body: nil , block: block)
114114 }
115115
116116 /// Move an existing index.
117117 ///
118118 /// :param: srcIndexName the name of index to move.
119119 /// :param: dstIndexName the new index name that will contains sourceIndexName (destination will be overriten if it already exist).
120- public func moveIndex( srcIndexName: String , dstIndexName: String , block: CompletionHandlerType ? ) {
120+ public func moveIndex( srcIndexName: String , dstIndexName: String , block: CompletionHandlerType ? = nil ) {
121121 let path = " 1/indexes/ \( srcIndexName. urlEncode ( ) ) /operation "
122122 let request = [
123123 " destination " : dstIndexName,
@@ -131,7 +131,7 @@ public class Client {
131131 ///
132132 /// :param: srcIndexName the name of index to copy.
133133 /// :param: dstIndexName the new index name that will contains a copy of sourceIndexName (destination will be overriten if it already exist).
134- public func copyIndex( srcIndexName: String , dstIndexName: String , block: CompletionHandlerType ? ) {
134+ public func copyIndex( srcIndexName: String , dstIndexName: String , block: CompletionHandlerType ? = nil ) {
135135 let path = " 1/indexes/ \( srcIndexName. urlEncode ( ) ) /operation "
136136 let request = [
137137 " destination " : dstIndexName,
@@ -145,7 +145,7 @@ public class Client {
145145 ///
146146 /// :param: indexName the name of index to delete
147147 /// :return: JSON Object in the block in the form: { "deletedAt": "2013-01-18T15:33:13.556Z", "taskID": 721 }
148- public func deleteIndex( indexName: String , block: CompletionHandlerType ? ) {
148+ public func deleteIndex( indexName: String , block: CompletionHandlerType ? = nil ) {
149149 let path = " 1/indexes/ \( indexName. urlEncode ( ) ) "
150150 performHTTPQuery ( path, method: . DELETE, body: nil , block: block)
151151 }
@@ -182,17 +182,17 @@ public class Client {
182182 performHTTPQuery ( path, method: . GET, body: nil , block: block)
183183 }
184184
185- public func deleteUserKey( key: String , block: CompletionHandlerType ? ) {
185+ public func deleteUserKey( key: String , block: CompletionHandlerType ? = nil ) {
186186 let path = " 1/keys/ \( key) "
187187 performHTTPQuery ( path, method: . DELETE, body: nil , block: block)
188188 }
189189
190- public func addUserKey( acls: [ String ] , block: CompletionHandlerType ? ) {
190+ public func addUserKey( acls: [ String ] , block: CompletionHandlerType ? = nil ) {
191191 let request = [ " acl " : acls]
192192 performHTTPQuery ( " 1/keys " , method: . POST, body: request, block: block)
193193 }
194194
195- public func addUserKey( acls: [ String ] , withValidity validity: UInt , maxQueriesPerIPPerHour maxQueries: UInt , maxHitsPerQuery maxHits: UInt , block: CompletionHandlerType ? ) {
195+ public func addUserKey( acls: [ String ] , withValidity validity: UInt , maxQueriesPerIPPerHour maxQueries: UInt , maxHitsPerQuery maxHits: UInt , block: CompletionHandlerType ? = nil ) {
196196 let request : [ String : AnyObject ] = [
197197 " acl " : acls,
198198 " validity " : validity,
@@ -203,7 +203,7 @@ public class Client {
203203 performHTTPQuery ( " 1/keys " , method: . POST, body: request, block: block)
204204 }
205205
206- public func addUserKey( acls: [ String ] , withIndexes indexes: [ String ] , withValidity validity: UInt , maxQueriesPerIPPerHour maxQueries: UInt , maxHitsPerQuery maxHits: UInt , block: CompletionHandlerType ? ) {
206+ public func addUserKey( acls: [ String ] , withIndexes indexes: [ String ] , withValidity validity: UInt , maxQueriesPerIPPerHour maxQueries: UInt , maxHitsPerQuery maxHits: UInt , block: CompletionHandlerType ? = nil ) {
207207 let request : [ String : AnyObject ] = [
208208 " acl " : acls,
209209 " indexes " : indexes,
@@ -215,13 +215,13 @@ public class Client {
215215 performHTTPQuery ( " 1/keys " , method: . POST, body: request, block: block)
216216 }
217217
218- public func updateUserKey( key: String , withACL acls: [ String ] , block: CompletionHandlerType ? ) {
218+ public func updateUserKey( key: String , withACL acls: [ String ] , block: CompletionHandlerType ? = nil ) {
219219 let path = " 1/keys/ \( key) "
220220 let request = [ " acl " : acls]
221221 performHTTPQuery ( path, method: . PUT, body: request, block: block)
222222 }
223223
224- public func updateUserKey( key: String , withACL acls: [ String ] , andValidity validity: UInt , maxQueriesPerIPPerHour maxQueries: UInt , maxHitsPerQuery maxHits: UInt , block: CompletionHandlerType ? ) {
224+ public func updateUserKey( key: String , withACL acls: [ String ] , andValidity validity: UInt , maxQueriesPerIPPerHour maxQueries: UInt , maxHitsPerQuery maxHits: UInt , block: CompletionHandlerType ? = nil ) {
225225 let path = " 1/keys/ \( key) "
226226 let request : [ String : AnyObject ] = [
227227 " acl " : acls,
@@ -233,7 +233,7 @@ public class Client {
233233 performHTTPQuery ( path, method: . PUT, body: request, block: block)
234234 }
235235
236- public func updateUserKey( key: String , withACL acls: [ String ] , withIndexes indexes: [ String ] , andValidity validity: UInt , maxQueriesPerIPPerHour maxQueries: UInt , maxHitsPerQuery maxHits: UInt , block: CompletionHandlerType ? ) {
236+ public func updateUserKey( key: String , withACL acls: [ String ] , withIndexes indexes: [ String ] , andValidity validity: UInt , maxQueriesPerIPPerHour maxQueries: UInt , maxHitsPerQuery maxHits: UInt , block: CompletionHandlerType ? = nil ) {
237237 let path = " 1/keys/ \( key) "
238238 let request : [ String : AnyObject ] = [
239239 " acl " : acls,
@@ -249,7 +249,7 @@ public class Client {
249249 // MARK: - Network
250250
251251 /// Perform an HTTP Query
252- func performHTTPQuery( path: String , method: Alamofire . Method , body: [ String : AnyObject ] ? , index: Int = 0 , block: CompletionHandlerType ? ) {
252+ func performHTTPQuery( path: String , method: Alamofire . Method , body: [ String : AnyObject ] ? , index: Int = 0 , block: CompletionHandlerType ? = nil ) {
253253 assert ( index < hostnames. count, " \( index) < \( hostnames. count) ! " )
254254
255255 Alamofire . request ( method, " https:// \( hostnames [ index] ) / \( path) " , parameters: body) . responseJSON {
0 commit comments