rushdb 1.0.0__tar.gz → 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rushdb
3
- Version: 1.0.0
3
+ Version: 1.2.0
4
4
  Summary: RushDB Python SDK
5
5
  Home-page: https://github.com/rushdb/rushdb-python
6
6
  License: Apache-2.0
@@ -226,7 +226,7 @@ Searches for records matching specified criteria.
226
226
  ```python
227
227
  def find(
228
228
  self,
229
- query: Optional[SearchQuery] = None,
229
+ search_query: Optional[SearchQuery] = None,
230
230
  record_id: Optional[str] = None,
231
231
  transaction: Optional[Transaction] = None
232
232
  ) -> List[Record]
@@ -853,7 +853,7 @@ Retrieves a list of properties based on optional search criteria.
853
853
  ```python
854
854
  def find(
855
855
  self,
856
- query: Optional[SearchQuery] = None,
856
+ search_query: Optional[SearchQuery] = None,
857
857
  transaction: Optional[Transaction] = None
858
858
  ) -> List[Property]
859
859
  ```
@@ -203,7 +203,7 @@ Searches for records matching specified criteria.
203
203
  ```python
204
204
  def find(
205
205
  self,
206
- query: Optional[SearchQuery] = None,
206
+ search_query: Optional[SearchQuery] = None,
207
207
  record_id: Optional[str] = None,
208
208
  transaction: Optional[Transaction] = None
209
209
  ) -> List[Record]
@@ -830,7 +830,7 @@ Retrieves a list of properties based on optional search criteria.
830
830
  ```python
831
831
  def find(
832
832
  self,
833
- query: Optional[SearchQuery] = None,
833
+ search_query: Optional[SearchQuery] = None,
834
834
  transaction: Optional[Transaction] = None
835
835
  ) -> List[Property]
836
836
  ```
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "rushdb"
3
- version = "1.0.0"
3
+ version = "1.2.0"
4
4
  description = "RushDB Python SDK"
5
5
  authors = ["RushDB Team <hi@rushdb.com>"]
6
6
  license = "Apache-2.0"
@@ -11,7 +11,7 @@ class LabelsAPI(BaseAPI):
11
11
 
12
12
  def list(
13
13
  self,
14
- query: Optional[SearchQuery] = None,
14
+ search_query: Optional[SearchQuery] = None,
15
15
  transaction: Optional[Transaction] = None,
16
16
  ) -> List[str]:
17
17
  """List all labels."""
@@ -19,7 +19,7 @@ class LabelsAPI(BaseAPI):
19
19
 
20
20
  return self.client._make_request(
21
21
  "POST",
22
- "/api/v1/labels/search",
23
- data=typing.cast(typing.Dict[str, typing.Any], query or {}),
22
+ "/labels/search",
23
+ data=typing.cast(typing.Dict[str, typing.Any], search_query or {}),
24
24
  headers=headers,
25
25
  )
@@ -1,5 +1,5 @@
1
1
  import typing
2
- from typing import List, Literal, Optional
2
+ from typing import List, Optional
3
3
 
4
4
  from ..models.property import Property, PropertyValuesData
5
5
  from ..models.search_query import SearchQuery
@@ -7,12 +7,18 @@ from ..models.transaction import Transaction
7
7
  from .base import BaseAPI
8
8
 
9
9
 
10
+ class PropertyValuesQuery(SearchQuery, total=False):
11
+ """Extended SearchQuery for property values endpoint with text search support."""
12
+
13
+ query: Optional[str] # For text search among values
14
+
15
+
10
16
  class PropertiesAPI(BaseAPI):
11
17
  """API for managing properties in RushDB."""
12
18
 
13
19
  def find(
14
20
  self,
15
- query: Optional[SearchQuery] = None,
21
+ search_query: Optional[SearchQuery] = None,
16
22
  transaction: Optional[Transaction] = None,
17
23
  ) -> List[Property]:
18
24
  """List all properties."""
@@ -20,8 +26,8 @@ class PropertiesAPI(BaseAPI):
20
26
 
21
27
  return self.client._make_request(
22
28
  "POST",
23
- "/api/v1/properties/search",
24
- typing.cast(typing.Dict[str, typing.Any], query or {}),
29
+ "/properties/search",
30
+ typing.cast(typing.Dict[str, typing.Any], search_query or {}),
25
31
  headers,
26
32
  )
27
33
 
@@ -32,7 +38,7 @@ class PropertiesAPI(BaseAPI):
32
38
  headers = Transaction._build_transaction_header(transaction)
33
39
 
34
40
  return self.client._make_request(
35
- "GET", f"/api/v1/properties/{property_id}", headers=headers
41
+ "GET", f"/properties/{property_id}", headers=headers
36
42
  )
37
43
 
38
44
  def delete(
@@ -42,24 +48,21 @@ class PropertiesAPI(BaseAPI):
42
48
  headers = Transaction._build_transaction_header(transaction)
43
49
 
44
50
  return self.client._make_request(
45
- "DELETE", f"/api/v1/properties/{property_id}", headers=headers
51
+ "DELETE", f"/properties/{property_id}", headers=headers
46
52
  )
47
53
 
48
54
  def values(
49
55
  self,
50
56
  property_id: str,
51
- sort: Optional[Literal["asc", "desc"]],
52
- query: Optional[str],
53
- skip: Optional[int],
54
- limit: Optional[int],
57
+ search_query: Optional[PropertyValuesQuery] = None,
55
58
  transaction: Optional[Transaction] = None,
56
59
  ) -> PropertyValuesData:
57
60
  """Get values data for a property."""
58
61
  headers = Transaction._build_transaction_header(transaction)
59
62
 
60
63
  return self.client._make_request(
61
- "GET",
62
- f"/api/v1/properties/{property_id}/values",
63
- headers=headers,
64
- params={"sort": sort, "skip": skip, "limit": limit, "query": query},
64
+ "POST",
65
+ f"/properties/{property_id}/values",
66
+ typing.cast(typing.Dict[str, typing.Any], search_query or {}),
67
+ headers,
65
68
  )
@@ -19,9 +19,7 @@ class RecordsAPI(BaseAPI):
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 @@ class RecordsAPI(BaseAPI):
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 @@ class RecordsAPI(BaseAPI):
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 @@ class RecordsAPI(BaseAPI):
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 @@ class RecordsAPI(BaseAPI):
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 @@ class RecordsAPI(BaseAPI):
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 @@ class RecordsAPI(BaseAPI):
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 @@ class RecordsAPI(BaseAPI):
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 @@ class RecordsAPI(BaseAPI):
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
@@ -20,7 +20,7 @@ class RelationsAPI(BaseAPI):
20
20
 
21
21
  async def find(
22
22
  self,
23
- query: Optional[SearchQuery] = None,
23
+ search_query: Optional[SearchQuery] = None,
24
24
  pagination: Optional[PaginationParams] = None,
25
25
  transaction: Optional[Union[Transaction, str]] = None,
26
26
  ) -> List[Relationship]:
@@ -33,6 +33,9 @@ class RelationsAPI(BaseAPI):
33
33
 
34
34
  Returns:
35
35
  List of matching relations
36
+ :param transaction:
37
+ :param pagination:
38
+ :param search_query:
36
39
  """
37
40
  # Build query string for pagination
38
41
  query_params = {}
@@ -53,7 +56,7 @@ class RelationsAPI(BaseAPI):
53
56
  response = self.client._make_request(
54
57
  method="POST",
55
58
  path=path,
56
- data=typing.cast(typing.Dict[str, typing.Any], query or {}),
59
+ data=typing.cast(typing.Dict[str, typing.Any], search_query or {}),
57
60
  headers=headers,
58
61
  )
59
62
 
@@ -13,17 +13,13 @@ class TransactionsAPI(BaseAPI):
13
13
  Returns:
14
14
  Transaction object
15
15
  """
16
- response = self.client._make_request("POST", "/api/v1/tx", {"ttl": ttl or 5000})
16
+ response = self.client._make_request("POST", "/tx", {"ttl": ttl or 5000})
17
17
  return Transaction(self.client, response.get("data")["id"])
18
18
 
19
19
  def _commit(self, transaction_id: str) -> None:
20
20
  """Internal method to commit a transaction."""
21
- return self.client._make_request(
22
- "POST", f"/api/v1/tx/{transaction_id}/commit", {}
23
- )
21
+ return self.client._make_request("POST", f"/tx/{transaction_id}/commit", {})
24
22
 
25
23
  def _rollback(self, transaction_id: str) -> None:
26
24
  """Internal method to rollback a transaction."""
27
- return self.client._make_request(
28
- "POST", f"/api/v1/tx/{transaction_id}/rollback", {}
29
- )
25
+ return self.client._make_request("POST", f"/tx/{transaction_id}/rollback", {})
@@ -16,14 +16,14 @@ from .common import RushDBError
16
16
  class RushDB:
17
17
  """Main client for interacting with RushDB."""
18
18
 
19
- DEFAULT_BASE_URL = "https://api.rushdb.com"
19
+ DEFAULT_BASE_URL = "https://api.rushdb.com/api/v1"
20
20
 
21
21
  def __init__(self, api_key: str, base_url: Optional[str] = None):
22
22
  """Initialize the RushDB client.
23
23
 
24
24
  Args:
25
25
  api_key: The API key for authentication
26
- base_url: Optional base URL for the RushDB server (default: https://api.rushdb.com)
26
+ base_url: Optional base URL for the RushDB server (default: https://api.rushdb.com/api/v1)
27
27
  """
28
28
  self.base_url = (base_url or self.DEFAULT_BASE_URL).rstrip("/")
29
29
  self.api_key = api_key
File without changes
File without changes
File without changes
File without changes