Skip to content

Commit 26170a5

Browse files
feat(api): api update (#25)
1 parent 83dcd1d commit 26170a5

File tree

7 files changed

+4
-264
lines changed

7 files changed

+4
-264
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 3
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-d975cb3c41e7b2790db4938b1de2b89c4005825a6347ae29ca4998f2c5b1a1be.yml
1+
configured_endpoints: 2
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-363c228e40d56a22d2ffff0751e999364709fb95ff4bae587ce8659008d67323.yml

api.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ Methods:
1515
Types:
1616

1717
```python
18-
from hyperspell.types import Document, DocumentListResponse
18+
from hyperspell.types import Document
1919
```
2020

2121
Methods:
2222

2323
- <code title="get /documents/get/{document_id}">client.documents.<a href="./src/hyperspell/resources/documents.py">retrieve</a>(document_id) -> <a href="./src/hyperspell/types/document.py">Document</a></code>
24-
- <code title="post /documents/list">client.documents.<a href="./src/hyperspell/resources/documents.py">list</a>(\*\*<a href="src/hyperspell/types/document_list_params.py">params</a>) -> <a href="./src/hyperspell/types/document_list_response.py">DocumentListResponse</a></code>

src/hyperspell/resources/documents.py

Lines changed: 0 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,9 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
6-
75
import httpx
86

9-
from ..types import document_list_params
107
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
11-
from .._utils import (
12-
maybe_transform,
13-
async_maybe_transform,
14-
)
158
from .._compat import cached_property
169
from .._resource import SyncAPIResource, AsyncAPIResource
1710
from .._response import (
@@ -22,7 +15,6 @@
2215
)
2316
from .._base_client import make_request_options
2417
from ..types.document import Document
25-
from ..types.document_list_response import DocumentListResponse
2618

2719
__all__ = ["DocumentsResource", "AsyncDocumentsResource"]
2820

@@ -78,52 +70,6 @@ def retrieve(
7870
cast_to=Document,
7971
)
8072

81-
def list(
82-
self,
83-
*,
84-
collection: str,
85-
cursor: Optional[str] | NotGiven = NOT_GIVEN,
86-
size: int | NotGiven = NOT_GIVEN,
87-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
88-
# The extra values given here take precedence over values defined on the client or passed to this method.
89-
extra_headers: Headers | None = None,
90-
extra_query: Query | None = None,
91-
extra_body: Body | None = None,
92-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
93-
) -> DocumentListResponse:
94-
"""This endpoint allows you to paginate through all documents in the index.
95-
96-
You can
97-
filter the documents by title, date, metadata, etc.
98-
99-
Args:
100-
extra_headers: Send extra headers
101-
102-
extra_query: Add additional query parameters to the request
103-
104-
extra_body: Add additional JSON properties to the request
105-
106-
timeout: Override the client-level default timeout for this request, in seconds
107-
"""
108-
return self._post(
109-
"/documents/list",
110-
options=make_request_options(
111-
extra_headers=extra_headers,
112-
extra_query=extra_query,
113-
extra_body=extra_body,
114-
timeout=timeout,
115-
query=maybe_transform(
116-
{
117-
"collection": collection,
118-
"cursor": cursor,
119-
"size": size,
120-
},
121-
document_list_params.DocumentListParams,
122-
),
123-
),
124-
cast_to=DocumentListResponse,
125-
)
126-
12773

12874
class AsyncDocumentsResource(AsyncAPIResource):
12975
@cached_property
@@ -176,52 +122,6 @@ async def retrieve(
176122
cast_to=Document,
177123
)
178124

179-
async def list(
180-
self,
181-
*,
182-
collection: str,
183-
cursor: Optional[str] | NotGiven = NOT_GIVEN,
184-
size: int | NotGiven = NOT_GIVEN,
185-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
186-
# The extra values given here take precedence over values defined on the client or passed to this method.
187-
extra_headers: Headers | None = None,
188-
extra_query: Query | None = None,
189-
extra_body: Body | None = None,
190-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
191-
) -> DocumentListResponse:
192-
"""This endpoint allows you to paginate through all documents in the index.
193-
194-
You can
195-
filter the documents by title, date, metadata, etc.
196-
197-
Args:
198-
extra_headers: Send extra headers
199-
200-
extra_query: Add additional query parameters to the request
201-
202-
extra_body: Add additional JSON properties to the request
203-
204-
timeout: Override the client-level default timeout for this request, in seconds
205-
"""
206-
return await self._post(
207-
"/documents/list",
208-
options=make_request_options(
209-
extra_headers=extra_headers,
210-
extra_query=extra_query,
211-
extra_body=extra_body,
212-
timeout=timeout,
213-
query=await async_maybe_transform(
214-
{
215-
"collection": collection,
216-
"cursor": cursor,
217-
"size": size,
218-
},
219-
document_list_params.DocumentListParams,
220-
),
221-
),
222-
cast_to=DocumentListResponse,
223-
)
224-
225125

226126
class DocumentsResourceWithRawResponse:
227127
def __init__(self, documents: DocumentsResource) -> None:
@@ -230,9 +130,6 @@ def __init__(self, documents: DocumentsResource) -> None:
230130
self.retrieve = to_raw_response_wrapper(
231131
documents.retrieve,
232132
)
233-
self.list = to_raw_response_wrapper(
234-
documents.list,
235-
)
236133

237134

238135
class AsyncDocumentsResourceWithRawResponse:
@@ -242,9 +139,6 @@ def __init__(self, documents: AsyncDocumentsResource) -> None:
242139
self.retrieve = async_to_raw_response_wrapper(
243140
documents.retrieve,
244141
)
245-
self.list = async_to_raw_response_wrapper(
246-
documents.list,
247-
)
248142

249143

250144
class DocumentsResourceWithStreamingResponse:
@@ -254,9 +148,6 @@ def __init__(self, documents: DocumentsResource) -> None:
254148
self.retrieve = to_streamed_response_wrapper(
255149
documents.retrieve,
256150
)
257-
self.list = to_streamed_response_wrapper(
258-
documents.list,
259-
)
260151

261152

262153
class AsyncDocumentsResourceWithStreamingResponse:
@@ -266,6 +157,3 @@ def __init__(self, documents: AsyncDocumentsResource) -> None:
266157
self.retrieve = async_to_streamed_response_wrapper(
267158
documents.retrieve,
268159
)
269-
self.list = async_to_streamed_response_wrapper(
270-
documents.list,
271-
)

src/hyperspell/types/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@
33
from __future__ import annotations
44

55
from .document import Document as Document
6-
from .document_list_params import DocumentListParams as DocumentListParams
76
from .query_retrieve_params import QueryRetrieveParams as QueryRetrieveParams
8-
from .document_list_response import DocumentListResponse as DocumentListResponse

src/hyperspell/types/document_list_params.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/hyperspell/types/document_list_response.py

Lines changed: 0 additions & 49 deletions
This file was deleted.

tests/api_resources/test_documents.py

Lines changed: 1 addition & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from hyperspell import Hyperspell, AsyncHyperspell
1111
from tests.utils import assert_matches_type
12-
from hyperspell.types import Document, DocumentListResponse
12+
from hyperspell.types import Document
1313

1414
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
1515

@@ -48,46 +48,6 @@ def test_streaming_response_retrieve(self, client: Hyperspell) -> None:
4848

4949
assert cast(Any, response.is_closed) is True
5050

51-
@parametrize
52-
def test_method_list(self, client: Hyperspell) -> None:
53-
document = client.documents.list(
54-
collection="collection",
55-
)
56-
assert_matches_type(DocumentListResponse, document, path=["response"])
57-
58-
@parametrize
59-
def test_method_list_with_all_params(self, client: Hyperspell) -> None:
60-
document = client.documents.list(
61-
collection="collection",
62-
cursor="cursor",
63-
size=0,
64-
)
65-
assert_matches_type(DocumentListResponse, document, path=["response"])
66-
67-
@parametrize
68-
def test_raw_response_list(self, client: Hyperspell) -> None:
69-
response = client.documents.with_raw_response.list(
70-
collection="collection",
71-
)
72-
73-
assert response.is_closed is True
74-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
75-
document = response.parse()
76-
assert_matches_type(DocumentListResponse, document, path=["response"])
77-
78-
@parametrize
79-
def test_streaming_response_list(self, client: Hyperspell) -> None:
80-
with client.documents.with_streaming_response.list(
81-
collection="collection",
82-
) as response:
83-
assert not response.is_closed
84-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
85-
86-
document = response.parse()
87-
assert_matches_type(DocumentListResponse, document, path=["response"])
88-
89-
assert cast(Any, response.is_closed) is True
90-
9151

9252
class TestAsyncDocuments:
9353
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
@@ -122,43 +82,3 @@ async def test_streaming_response_retrieve(self, async_client: AsyncHyperspell)
12282
assert_matches_type(Document, document, path=["response"])
12383

12484
assert cast(Any, response.is_closed) is True
125-
126-
@parametrize
127-
async def test_method_list(self, async_client: AsyncHyperspell) -> None:
128-
document = await async_client.documents.list(
129-
collection="collection",
130-
)
131-
assert_matches_type(DocumentListResponse, document, path=["response"])
132-
133-
@parametrize
134-
async def test_method_list_with_all_params(self, async_client: AsyncHyperspell) -> None:
135-
document = await async_client.documents.list(
136-
collection="collection",
137-
cursor="cursor",
138-
size=0,
139-
)
140-
assert_matches_type(DocumentListResponse, document, path=["response"])
141-
142-
@parametrize
143-
async def test_raw_response_list(self, async_client: AsyncHyperspell) -> None:
144-
response = await async_client.documents.with_raw_response.list(
145-
collection="collection",
146-
)
147-
148-
assert response.is_closed is True
149-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
150-
document = await response.parse()
151-
assert_matches_type(DocumentListResponse, document, path=["response"])
152-
153-
@parametrize
154-
async def test_streaming_response_list(self, async_client: AsyncHyperspell) -> None:
155-
async with async_client.documents.with_streaming_response.list(
156-
collection="collection",
157-
) as response:
158-
assert not response.is_closed
159-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
160-
161-
document = await response.parse()
162-
assert_matches_type(DocumentListResponse, document, path=["response"])
163-
164-
assert cast(Any, response.is_closed) is True

0 commit comments

Comments
 (0)