Skip to content

Commit 5987e14

Browse files
committed
Post-release cleanups
1 parent a3d01b9 commit 5987e14

File tree

8 files changed

+52
-46
lines changed

8 files changed

+52
-46
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ Searches for records matching specified criteria.
203203
```python
204204
def find(
205205
self,
206-
query: Optional[SearchQuery] = None,
206+
search_query: Optional[SearchQuery] = None,
207207
record_id: Optional[str] = None,
208208
transaction: Optional[Transaction] = None
209209
) -> List[Record]
@@ -830,7 +830,7 @@ Retrieves a list of properties based on optional search criteria.
830830
```python
831831
def find(
832832
self,
833-
query: Optional[SearchQuery] = None,
833+
search_query: Optional[SearchQuery] = None,
834834
transaction: Optional[Transaction] = None
835835
) -> List[Property]
836836
```

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "rushdb"
3-
version = "1.0.0"
3+
version = "1.1.0"
44
description = "RushDB Python SDK"
55
authors = ["RushDB Team <hi@rushdb.com>"]
66
license = "Apache-2.0"

src/rushdb/api/labels.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ class LabelsAPI(BaseAPI):
1111

1212
def list(
1313
self,
14-
query: Optional[SearchQuery] = None,
14+
search_query: Optional[SearchQuery] = None,
1515
transaction: Optional[Transaction] = None,
1616
) -> List[str]:
1717
"""List all labels."""
1818
headers = Transaction._build_transaction_header(transaction)
1919

2020
return self.client._make_request(
2121
"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 {}),
2424
headers=headers,
2525
)

src/rushdb/api/properties.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
11
import typing
2-
from typing import List, Literal, Optional
2+
from typing import List, Optional
33

44
from ..models.property import Property, PropertyValuesData
5-
from ..models.search_query import SearchQuery
5+
from ..models.search_query import SearchQuery, OrderDirection
66
from ..models.transaction import Transaction
77
from .base import BaseAPI
88

99

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+
orderBy: Optional[OrderDirection] # Simplified to only asc/desc for values
15+
1016
class PropertiesAPI(BaseAPI):
1117
"""API for managing properties in RushDB."""
1218

1319
def find(
1420
self,
15-
query: Optional[SearchQuery] = None,
21+
search_query: Optional[SearchQuery] = None,
1622
transaction: Optional[Transaction] = None,
1723
) -> List[Property]:
1824
"""List all properties."""
1925
headers = Transaction._build_transaction_header(transaction)
2026

2127
return self.client._make_request(
2228
"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 {}),
2531
headers,
2632
)
2733

@@ -32,7 +38,7 @@ def find_by_id(
3238
headers = Transaction._build_transaction_header(transaction)
3339

3440
return self.client._make_request(
35-
"GET", f"/api/v1/properties/{property_id}", headers=headers
41+
"GET", f"/properties/{property_id}", headers=headers
3642
)
3743

3844
def delete(
@@ -42,24 +48,21 @@ def delete(
4248
headers = Transaction._build_transaction_header(transaction)
4349

4450
return self.client._make_request(
45-
"DELETE", f"/api/v1/properties/{property_id}", headers=headers
51+
"DELETE", f"/properties/{property_id}", headers=headers
4652
)
4753

4854
def values(
4955
self,
5056
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,
5558
transaction: Optional[Transaction] = None,
5659
) -> PropertyValuesData:
5760
"""Get values data for a property."""
5861
headers = Transaction._build_transaction_header(transaction)
5962

6063
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,
6568
)

src/rushdb/api/records.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def set(
2020
"""Update a record by ID."""
2121
headers = Transaction._build_transaction_header(transaction)
2222
return self.client._make_request(
23-
"PUT", f"/api/v1/records/{record_id}", data, headers
23+
"PUT", f"/records/{record_id}", data, headers
2424
)
2525

2626
def update(
@@ -33,7 +33,7 @@ def update(
3333
headers = Transaction._build_transaction_header(transaction)
3434

3535
return self.client._make_request(
36-
"PATCH", f"/api/v1/records/{record_id}", data, headers
36+
"PATCH", f"/records/{record_id}", data, headers
3737
)
3838

3939
def create(
@@ -63,7 +63,7 @@ def create(
6363
"options": options or {"returnResult": True, "suggestTypes": True},
6464
}
6565
response = self.client._make_request(
66-
"POST", "/api/v1/records", payload, headers
66+
"POST", "/records", payload, headers
6767
)
6868
return Record(self.client, response.get("data"))
6969

@@ -93,7 +93,7 @@ def create_many(
9393
"options": options or {"returnResult": True, "suggestTypes": True},
9494
}
9595
response = self.client._make_request(
96-
"POST", "/api/v1/records/import/json", payload, headers
96+
"POST", "/records/import/json", payload, headers
9797
)
9898
return [Record(self.client, record) for record in response.get("data")]
9999

@@ -120,7 +120,7 @@ def attach(
120120
if options:
121121
payload.update(typing.cast(typing.Dict[str, typing.Any], options))
122122
return self.client._make_request(
123-
"POST", f"/api/v1/relationships/{source_id}", payload, headers
123+
"POST", f"/relationships/{source_id}", payload, headers
124124
)
125125

126126
def detach(
@@ -146,19 +146,19 @@ def detach(
146146
if options:
147147
payload.update(typing.cast(typing.Dict[str, typing.Any], options))
148148
return self.client._make_request(
149-
"PUT", f"/api/v1/relationships/{source_id}", payload, headers
149+
"PUT", f"/relationships/{source_id}", payload, headers
150150
)
151151

152152
def delete(
153-
self, query: SearchQuery, transaction: Optional[Transaction] = None
153+
self, search_query: SearchQuery, transaction: Optional[Transaction] = None
154154
) -> Dict[str, str]:
155155
"""Delete records matching the query."""
156156
headers = Transaction._build_transaction_header(transaction)
157157

158158
return self.client._make_request(
159-
"PUT",
160-
"/api/v1/records/delete",
161-
typing.cast(typing.Dict[str, typing.Any], query or {}),
159+
"POST",
160+
"/records/delete",
161+
typing.cast(typing.Dict[str, typing.Any], search_query or {}),
162162
headers,
163163
)
164164

@@ -172,18 +172,18 @@ def delete_by_id(
172172

173173
if isinstance(id_or_ids, list):
174174
return self.client._make_request(
175-
"PUT",
176-
"/api/v1/records/delete",
175+
"POST",
176+
"/records/delete",
177177
{"limit": 1000, "where": {"$id": {"$in": id_or_ids}}},
178178
headers,
179179
)
180180
return self.client._make_request(
181-
"DELETE", f"/api/v1/records/{id_or_ids}", None, headers
181+
"DELETE", f"/records/{id_or_ids}", None, headers
182182
)
183183

184184
def find(
185185
self,
186-
query: Optional[SearchQuery] = None,
186+
search_query: Optional[SearchQuery] = None,
187187
record_id: Optional[str] = None,
188188
transaction: Optional[Transaction] = None,
189189
) -> List[Record]:
@@ -193,14 +193,14 @@ def find(
193193
headers = Transaction._build_transaction_header(transaction)
194194

195195
path = (
196-
f"/api/v1/records/{record_id}/search"
196+
f"/records/{record_id}/search"
197197
if record_id
198-
else "/api/v1/records/search"
198+
else "/records/search"
199199
)
200200
response = self.client._make_request(
201201
"POST",
202202
path,
203-
data=typing.cast(typing.Dict[str, typing.Any], query or {}),
203+
data=typing.cast(typing.Dict[str, typing.Any], search_query or {}),
204204
headers=headers,
205205
)
206206
return [Record(self.client, record) for record in response.get("data")]
@@ -224,7 +224,7 @@ def import_csv(
224224
}
225225

226226
return self.client._make_request(
227-
"POST", "/api/v1/records/import/csv", payload, headers
227+
"POST", "/records/import/csv", payload, headers
228228
)
229229

230230
@staticmethod

src/rushdb/api/relationships.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class RelationsAPI(BaseAPI):
2020

2121
async def find(
2222
self,
23-
query: Optional[SearchQuery] = None,
23+
search_query: Optional[SearchQuery] = None,
2424
pagination: Optional[PaginationParams] = None,
2525
transaction: Optional[Union[Transaction, str]] = None,
2626
) -> List[Relationship]:
@@ -33,6 +33,9 @@ async def find(
3333
3434
Returns:
3535
List of matching relations
36+
:param transaction:
37+
:param pagination:
38+
:param search_query:
3639
"""
3740
# Build query string for pagination
3841
query_params = {}
@@ -53,7 +56,7 @@ async def find(
5356
response = self.client._make_request(
5457
method="POST",
5558
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 {}),
5760
headers=headers,
5861
)
5962

src/rushdb/api/transactions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ def begin(self, ttl: Optional[int] = None) -> Transaction:
1313
Returns:
1414
Transaction object
1515
"""
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})
1717
return Transaction(self.client, response.get("data")["id"])
1818

1919
def _commit(self, transaction_id: str) -> None:
2020
"""Internal method to commit a transaction."""
2121
return self.client._make_request(
22-
"POST", f"/api/v1/tx/{transaction_id}/commit", {}
22+
"POST", f"/tx/{transaction_id}/commit", {}
2323
)
2424

2525
def _rollback(self, transaction_id: str) -> None:
2626
"""Internal method to rollback a transaction."""
2727
return self.client._make_request(
28-
"POST", f"/api/v1/tx/{transaction_id}/rollback", {}
28+
"POST", f"/tx/{transaction_id}/rollback", {}
2929
)

src/rushdb/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
class RushDB:
1717
"""Main client for interacting with RushDB."""
1818

19-
DEFAULT_BASE_URL = "https://api.rushdb.com"
19+
DEFAULT_BASE_URL = "https://api.rushdb.com/api/v1"
2020

2121
def __init__(self, api_key: str, base_url: Optional[str] = None):
2222
"""Initialize the RushDB client.
2323
2424
Args:
2525
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)
2727
"""
2828
self.base_url = (base_url or self.DEFAULT_BASE_URL).rstrip("/")
2929
self.api_key = api_key

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy