@@ -85,12 +85,33 @@ public class Client {
8585
8686 // MARK: - Operations
8787
88+ /// List all existing indexes
89+ ///
90+ /// :return: JSON Object in the success block in the form:
91+ /// { "items": [ {"name": "contacts", "createdAt": "2013-01-18T15:33:13.556Z"},
92+ /// {"name": "notes", "createdAt": "2013-01-18T15:33:13.556Z"}]}
8893 public func listIndexes( block: ( client: Client , JSON: AnyObject ? , error: NSError ? ) -> Void ) {
8994 performHTTPQuery ( " 1/indexes " , method: . GET, body: nil , block: { ( JSON, error) -> Void in
9095 block ( client: self , JSON: JSON, error: error)
9196 } )
9297 }
9398
99+ /// Move an existing index.
100+ ///
101+ /// :param: sourceIndexName the name of index to copy.
102+ /// :param: destinationIndexName the new index name that will contains a copy of sourceIndexName (destination will be overriten if it already exist).
103+ public func moveIndex( sourceIndexName srcIndexName: String , destinationIndexName dstIndexName: String , block: ( client: Client , JSON: AnyObject ? , error: NSError ? ) -> Void ) {
104+ let path = " 1/indexes/ \( srcIndexName. urlEncode ( ) ) /operation "
105+ let request = [
106+ " destination " : dstIndexName,
107+ " operation " : " move "
108+ ]
109+
110+ performHTTPQuery ( path, method: . POST, body: request, block: { ( JSON, error) -> Void in
111+ block ( client: self , JSON: JSON, error: error)
112+ } )
113+ }
114+
94115 // MARK: - Network
95116
96117 /// Perform an HTTP Query
0 commit comments