@@ -33,7 +33,7 @@ def upsert(self, collection_name, data):
33
33
34
34
data_json = {collection_name : data }
35
35
36
- response = self .client .post ('meta /' , service_name = 'api' ,
36
+ response = self .client .post ('collections /' , service_name = 'api' ,
37
37
signature = self .token , data = {'data' : data_json })
38
38
return response
39
39
@@ -59,12 +59,12 @@ def select(self, collection_name, ids):
59
59
foreign_ids .append ('%s:%s' % (collection_name , ids [i ]))
60
60
foreign_ids = ',' .join (foreign_ids )
61
61
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 },
63
63
signature = self .token )
64
64
65
65
return response
66
66
67
- def delete (self , collection_name , ids ):
67
+ def delete_many (self , collection_name , ids ):
68
68
"""
69
69
Delete data from meta.
70
70
:param collection_name: Collection Name i.e 'user'
@@ -82,7 +82,37 @@ def delete(self, collection_name, ids):
82
82
83
83
params = {'collection_name' : collection_name , 'ids' : ids }
84
84
85
- response = self .client .delete ('meta /' , service_name = 'api' , params = params ,
85
+ response = self .client .delete ('collections /' , service_name = 'api' , params = params ,
86
86
signature = self .token )
87
87
88
88
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