@@ -249,6 +249,32 @@ Collection.prototype.deleteDocument = function (arg, options, cb) {
249249  return  this ; 
250250} ; 
251251
252+ /** 
253+  * Deletes the current specifications of this collection 
254+  * 
255+  * @param  {object } [options] - Optional parameters 
256+  * @param  {responseCallback } [cb] - Handles the query response 
257+  * @return  {object } this 
258+  */ 
259+ Collection . prototype . deleteSpecifications  =  function  ( options ,  cb )  { 
260+   var 
261+     data  =  {  index : this . index ,  collection : this . collection  } , 
262+     self  =  this ; 
263+ 
264+   if  ( ! cb  &&  typeof  options  ===  'function' )  { 
265+     cb  =  options ; 
266+     options  =  null ; 
267+   } 
268+ 
269+   data  =  self . kuzzle . addHeaders ( data ,  this . headers ) ; 
270+ 
271+   self . kuzzle . query ( this . buildQueryArgs ( 'collection' ,  'deleteSpecifications' ) ,  data ,  options ,  function  ( err ,  res )  { 
272+     cb ( err ,  err  ? undefined  : res . result ) ; 
273+   } ) ; 
274+ 
275+   return  self ; 
276+ } ; 
277+ 
252278/** 
253279 * Returns a boolean indicating whether or not a document with provided ID exists. 
254280 * 
@@ -553,6 +579,30 @@ Collection.prototype.mUpdateDocument = function (documents, options, cb) {
553579  return  self ; 
554580} ; 
555581
582+ /** 
583+  * Retrieves the current specifications of this collection 
584+  * 
585+  * @param  {object } [options] - Optional parameters 
586+  * @param  {responseCallback } cb - Handles the query response 
587+  */ 
588+ Collection . prototype . getSpecifications  =  function  ( options ,  cb )  { 
589+   var 
590+     data  =  {  index : this . index ,  collection : this . collection  } , 
591+     self  =  this ; 
592+ 
593+   if  ( ! cb  &&  typeof  options  ===  'function' )  { 
594+     cb  =  options ; 
595+     options  =  null ; 
596+   } 
597+ 
598+   self . kuzzle . callbackRequired ( 'Collection.getSpecifications' ,  cb ) ; 
599+   data  =  self . kuzzle . addHeaders ( data ,  this . headers ) ; 
600+ 
601+   self . kuzzle . query ( this . buildQueryArgs ( 'collection' ,  'getSpecifications' ) ,  data ,  options ,  function  ( err ,  res )  { 
602+     cb ( err ,  err  ? undefined  : res . result ) ; 
603+   } ) ; 
604+ } ; 
605+ 
556606/** 
557607 * Publish a realtime message 
558608 * 
@@ -752,6 +802,68 @@ Collection.prototype.scroll = function (scrollId, options, filters, cb) {
752802  return  this ; 
753803} ; 
754804
805+ /** 
806+  * Retrieves next result of a search with scroll query. 
807+  * 
808+  * @param  {string } scrollId 
809+  * @param  {object } [options] - Optional parameters 
810+  * @param  {responseCallback } cb - Handles the query response 
811+  */ 
812+ Collection . prototype . scrollSpecifications  =  function  ( scrollId ,  options ,  cb )  { 
813+   var 
814+     data  =  {  scrollId : scrollId  } ; 
815+ 
816+   if  ( ! scrollId )  { 
817+     throw  new  Error ( 'Collection.scrollSpecifications: scrollId is required' ) ; 
818+   } 
819+ 
820+   if  ( ! cb  &&  typeof  options  ===  'function' )  { 
821+     cb  =  options ; 
822+     options  =  { } ; 
823+   } 
824+ 
825+   this . kuzzle . callbackRequired ( 'Collection.scrollSpecifications' ,  cb ) ; 
826+ 
827+   if  ( options  &&  options . scroll )  { 
828+     data . scroll  =  options . scroll ; 
829+   } 
830+ 
831+   this . kuzzle . query ( 
832+     {  controller : 'collection' ,  action : 'scrollSpecifications' } , 
833+     this . kuzzle . addHeaders ( data ,  this . headers ) , 
834+     options , 
835+     function  ( err ,  res )  { 
836+       cb  ( err ,  err  ? undefined  : res . result ) ; 
837+     } 
838+   ) ; 
839+ } ; 
840+ 
841+ /** 
842+  * Searches specifications across indexes/collections according to the provided filters 
843+  * 
844+  * @param  {object } [filters] - Optional filters in ElasticSearch Query DSL format 
845+  * @param  {object } [options] - Optional parameters 
846+  * @param  {responseCallback } cb - Handles the query response 
847+  */ 
848+ Collection . prototype . searchSpecifications  =  function  ( filters ,  options ,  cb )  { 
849+   var 
850+     data  =  {  body : {  query : filters  }  } , 
851+     self  =  this ; 
852+ 
853+   if  ( ! cb  &&  typeof  options  ===  'function' )  { 
854+     cb  =  options ; 
855+     options  =  { } ; 
856+   } 
857+ 
858+   self . kuzzle . callbackRequired ( 'Collection.searchSpecifications' ,  cb ) ; 
859+ 
860+   data  =  self . kuzzle . addHeaders ( data ,  this . headers ) ; 
861+ 
862+   self . kuzzle . query ( {  controller : 'collection' ,  action : 'searchSpecifications'  } ,  data ,  options ,  function  ( err ,  res )  { 
863+     cb ( err ,  err  ? undefined  : res . result ) ; 
864+   } ) ; 
865+ } ; 
866+ 
755867/** 
756868 * Subscribes to this data collection with a set of filters. 
757869 * To subscribe to the entire data collection, simply provide an empty filter. 
@@ -847,6 +959,65 @@ Collection.prototype.updateDocument = function (documentId, content, options, cb
847959  return  self ; 
848960} ; 
849961
962+ /** 
963+  * Updates the current specifications of this collection 
964+  * 
965+  * @param  {object } specifications - Specifications content 
966+  * @param  {object } [options] - Optional parameters 
967+  * @param  {responseCallback } [cb] - Handles the query response 
968+  * @return  {object } this 
969+  */ 
970+ Collection . prototype . updateSpecifications  =  function  ( specifications ,  options ,  cb )  { 
971+   var 
972+     collection  =  { } , 
973+     data  =  {  body : { }  } , 
974+     self  =  this ; 
975+ 
976+   collection [ this . collection ]  =  specifications ; 
977+   data . body [ this . index ]  =  collection ; 
978+ 
979+   if  ( ! cb  &&  typeof  options  ===  'function' )  { 
980+     cb  =  options ; 
981+     options  =  null ; 
982+   } 
983+ 
984+   data  =  self . kuzzle . addHeaders ( data ,  this . headers ) ; 
985+ 
986+   self . kuzzle . query ( this . buildQueryArgs ( 'collection' ,  'updateSpecifications' ) ,  data ,  options ,  cb  &&  function  ( err ,  res )  { 
987+     cb ( err ,  err  ? undefined  : res . result ) ; 
988+   } ) ; 
989+ 
990+   return  self ; 
991+ } ; 
992+ 
993+ /** 
994+  * Validates the provided specifications 
995+  * 
996+  * @param  {object } specifications - Specifications content 
997+  * @param  {object } [options] - Optional parameters 
998+  * @param  {responseCallback } cb - Handles the query response 
999+  */ 
1000+ Collection . prototype . validateSpecifications  =  function  ( specifications ,  options ,  cb )  { 
1001+   var 
1002+     collection  =  { } , 
1003+     data  =  {  body : { }  } , 
1004+     self  =  this ; 
1005+ 
1006+   collection [ this . collection ]  =  specifications ; 
1007+   data . body [ this . index ]  =  collection ; 
1008+ 
1009+   if  ( ! cb  &&  typeof  options  ===  'function' )  { 
1010+     cb  =  options ; 
1011+     options  =  null ; 
1012+   } 
1013+ 
1014+   self . kuzzle . callbackRequired ( 'Collection.validateSpecifications' ,  cb ) ; 
1015+   data  =  self . kuzzle . addHeaders ( data ,  this . headers ) ; 
1016+ 
1017+   self . kuzzle . query ( this . buildQueryArgs ( 'collection' ,  'validateSpecifications' ) ,  data ,  options ,  function  ( err ,  res )  { 
1018+     cb ( err ,  err  ? undefined  : res . result . valid ) ; 
1019+   } ) ; 
1020+ } ; 
8501021
8511022/** 
8521023 * Instantiate a new Document object. Workaround to the module.exports limitation, preventing multiple 
0 commit comments