@@ -19,9 +19,7 @@ def set(
19
19
) -> Dict [str , str ]:
20
20
"""Update a record by ID."""
21
21
headers = Transaction ._build_transaction_header (transaction )
22
- return self .client ._make_request (
23
- "PUT" , f"/api/v1/records/{ record_id } " , data , headers
24
- )
22
+ return self .client ._make_request ("PUT" , f"/records/{ record_id } " , data , headers )
25
23
26
24
def update (
27
25
self ,
@@ -33,7 +31,7 @@ def update(
33
31
headers = Transaction ._build_transaction_header (transaction )
34
32
35
33
return self .client ._make_request (
36
- "PATCH" , f"/api/v1/ records/{ record_id } " , data , headers
34
+ "PATCH" , f"/records/{ record_id } " , data , headers
37
35
)
38
36
39
37
def create (
@@ -62,9 +60,7 @@ def create(
62
60
"data" : data ,
63
61
"options" : options or {"returnResult" : True , "suggestTypes" : True },
64
62
}
65
- response = self .client ._make_request (
66
- "POST" , "/api/v1/records" , payload , headers
67
- )
63
+ response = self .client ._make_request ("POST" , "/records" , payload , headers )
68
64
return Record (self .client , response .get ("data" ))
69
65
70
66
def create_many (
@@ -93,7 +89,7 @@ def create_many(
93
89
"options" : options or {"returnResult" : True , "suggestTypes" : True },
94
90
}
95
91
response = self .client ._make_request (
96
- "POST" , "/api/v1/ records/import/json" , payload , headers
92
+ "POST" , "/records/import/json" , payload , headers
97
93
)
98
94
return [Record (self .client , record ) for record in response .get ("data" )]
99
95
@@ -120,7 +116,7 @@ def attach(
120
116
if options :
121
117
payload .update (typing .cast (typing .Dict [str , typing .Any ], options ))
122
118
return self .client ._make_request (
123
- "POST" , f"/api/v1/ relationships/{ source_id } " , payload , headers
119
+ "POST" , f"/relationships/{ source_id } " , payload , headers
124
120
)
125
121
126
122
def detach (
@@ -146,19 +142,19 @@ def detach(
146
142
if options :
147
143
payload .update (typing .cast (typing .Dict [str , typing .Any ], options ))
148
144
return self .client ._make_request (
149
- "PUT" , f"/api/v1/ relationships/{ source_id } " , payload , headers
145
+ "PUT" , f"/relationships/{ source_id } " , payload , headers
150
146
)
151
147
152
148
def delete (
153
- self , query : SearchQuery , transaction : Optional [Transaction ] = None
149
+ self , search_query : SearchQuery , transaction : Optional [Transaction ] = None
154
150
) -> Dict [str , str ]:
155
151
"""Delete records matching the query."""
156
152
headers = Transaction ._build_transaction_header (transaction )
157
153
158
154
return self .client ._make_request (
159
- "PUT " ,
160
- "/api/v1/ records/delete" ,
161
- typing .cast (typing .Dict [str , typing .Any ], query or {}),
155
+ "POST " ,
156
+ "/records/delete" ,
157
+ typing .cast (typing .Dict [str , typing .Any ], search_query or {}),
162
158
headers ,
163
159
)
164
160
@@ -172,18 +168,18 @@ def delete_by_id(
172
168
173
169
if isinstance (id_or_ids , list ):
174
170
return self .client ._make_request (
175
- "PUT " ,
176
- "/api/v1/ records/delete" ,
171
+ "POST " ,
172
+ "/records/delete" ,
177
173
{"limit" : 1000 , "where" : {"$id" : {"$in" : id_or_ids }}},
178
174
headers ,
179
175
)
180
176
return self .client ._make_request (
181
- "DELETE" , f"/api/v1/ records/{ id_or_ids } " , None , headers
177
+ "DELETE" , f"/records/{ id_or_ids } " , None , headers
182
178
)
183
179
184
180
def find (
185
181
self ,
186
- query : Optional [SearchQuery ] = None ,
182
+ search_query : Optional [SearchQuery ] = None ,
187
183
record_id : Optional [str ] = None ,
188
184
transaction : Optional [Transaction ] = None ,
189
185
) -> List [Record ]:
@@ -192,15 +188,11 @@ def find(
192
188
try :
193
189
headers = Transaction ._build_transaction_header (transaction )
194
190
195
- path = (
196
- f"/api/v1/records/{ record_id } /search"
197
- if record_id
198
- else "/api/v1/records/search"
199
- )
191
+ path = f"/records/{ record_id } /search" if record_id else "/records/search"
200
192
response = self .client ._make_request (
201
193
"POST" ,
202
194
path ,
203
- data = typing .cast (typing .Dict [str , typing .Any ], query or {}),
195
+ data = typing .cast (typing .Dict [str , typing .Any ], search_query or {}),
204
196
headers = headers ,
205
197
)
206
198
return [Record (self .client , record ) for record in response .get ("data" )]
@@ -224,7 +216,7 @@ def import_csv(
224
216
}
225
217
226
218
return self .client ._make_request (
227
- "POST" , "/api/v1/ records/import/csv" , payload , headers
219
+ "POST" , "/records/import/csv" , payload , headers
228
220
)
229
221
230
222
@staticmethod
0 commit comments