@@ -33,7 +33,7 @@ def upsert(self, collection_name, data):
3333
3434 data_json = {collection_name : data }
3535
36- response = self .client .post ('meta /' , service_name = 'api' ,
36+ response = self .client .post ('collections /' , service_name = 'api' ,
3737 signature = self .token , data = {'data' : data_json })
3838 return response
3939
@@ -59,12 +59,12 @@ def select(self, collection_name, ids):
5959 foreign_ids .append ('%s:%s' % (collection_name , ids [i ]))
6060 foreign_ids = ',' .join (foreign_ids )
6161
62- response = self .client .get ('meta /' , service_name = 'api' , params = {'foreign_ids' : foreign_ids },
62+ response = self .client .get ('collections /' , service_name = 'api' , params = {'foreign_ids' : foreign_ids },
6363 signature = self .token )
6464
6565 return response
6666
67- def delete (self , collection_name , ids ):
67+ def delete_many (self , collection_name , ids ):
6868 """
6969 Delete data from meta.
7070 :param collection_name: Collection Name i.e 'user'
@@ -82,7 +82,37 @@ def delete(self, collection_name, ids):
8282
8383 params = {'collection_name' : collection_name , 'ids' : ids }
8484
85- response = self .client .delete ('meta /' , service_name = 'api' , params = params ,
85+ response = self .client .delete ('collections /' , service_name = 'api' , params = params ,
8686 signature = self .token )
8787
8888 return response
89+
90+ def add (self , collection_name , data , id = None , user_id = None ):
91+ payload = dict (
92+ id = id , data = data , user_id = user_id ,
93+ )
94+ return self .client .post (
95+ "collections/%s" % collection_name ,
96+ service_name = "api" ,
97+ signature = self .token ,
98+ data = payload ,
99+ )
100+
101+ def get (self , collection_name , id ):
102+ return self .client .get (
103+ "collections/%s/%s" % (collection_name , id ), service_name = "api" , signature = self .token
104+ )
105+
106+ def update (self , collection_name , id , data = None ):
107+ payload = dict (data = data )
108+ return self .client .put (
109+ "collections/%s/%s" % (collection_name , id ),
110+ service_name = "api" ,
111+ signature = self .token ,
112+ data = payload ,
113+ )
114+
115+ def delete (self , collection_name , id ):
116+ return self .client .delete (
117+ "collections/%s/%s" % (collection_name , id ), service_name = "api" , signature = self .token
118+ )
0 commit comments