Skip to content

Commit 0106c49

Browse files
SDK regeneration (#49)
Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
1 parent 47f2258 commit 0106c49

File tree

9 files changed

+274
-3
lines changed

9 files changed

+274
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "credal"
33

44
[tool.poetry]
55
name = "credal"
6-
version = "0.1.1"
6+
version = "0.1.2"
77
description = ""
88
readme = "README.md"
99
authors = []

reference.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,6 +1332,80 @@ client.document_collections.remove_documents_from_collection(
13321332
</dl>
13331333

13341334

1335+
</dd>
1336+
</dl>
1337+
</details>
1338+
1339+
<details><summary><code>client.document_collections.<a href="src/credal/document_collections/client.py">list_documents_in_collection</a>(...)</code></summary>
1340+
<dl>
1341+
<dd>
1342+
1343+
#### 📝 Description
1344+
1345+
<dl>
1346+
<dd>
1347+
1348+
<dl>
1349+
<dd>
1350+
1351+
List documents in a collection
1352+
</dd>
1353+
</dl>
1354+
</dd>
1355+
</dl>
1356+
1357+
#### 🔌 Usage
1358+
1359+
<dl>
1360+
<dd>
1361+
1362+
<dl>
1363+
<dd>
1364+
1365+
```python
1366+
import uuid
1367+
1368+
from credal import CredalApi
1369+
1370+
client = CredalApi(
1371+
api_key="YOUR_API_KEY",
1372+
)
1373+
client.document_collections.list_documents_in_collection(
1374+
collection_id=uuid.UUID(
1375+
"82e4b12a-6990-45d4-8ebd-85c00e030c24",
1376+
),
1377+
)
1378+
1379+
```
1380+
</dd>
1381+
</dl>
1382+
</dd>
1383+
</dl>
1384+
1385+
#### ⚙️ Parameters
1386+
1387+
<dl>
1388+
<dd>
1389+
1390+
<dl>
1391+
<dd>
1392+
1393+
**collection_id:** `uuid.UUID` — The ID of the document collection to list documents from.
1394+
1395+
</dd>
1396+
</dl>
1397+
1398+
<dl>
1399+
<dd>
1400+
1401+
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
1402+
1403+
</dd>
1404+
</dl>
1405+
</dd>
1406+
</dl>
1407+
1408+
13351409
</dd>
13361410
</dl>
13371411
</details>

src/credal/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
from .document_collections import (
7272
CreateCollectionResponse,
7373
DeleteCollectionResponse,
74+
ListDocumentsInCollectionResponse,
7475
MongoCollectionSyncConfig,
7576
MongoCollectionSyncResponse,
7677
MongoSourceFieldsConfig,
@@ -142,6 +143,7 @@
142143
"InitialChunk",
143144
"InputVariable",
144145
"InsertedAuditLog",
146+
"ListDocumentsInCollectionResponse",
145147
"MessageBlocked",
146148
"MessageFeedback",
147149
"MessageReply",

src/credal/core/client_wrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ def __init__(
2222

2323
def get_headers(self) -> typing.Dict[str, str]:
2424
headers: typing.Dict[str, str] = {
25-
"User-Agent": "credal/0.1.1",
25+
"User-Agent": "credal/0.1.2",
2626
"X-Fern-Language": "Python",
2727
"X-Fern-SDK-Name": "credal",
28-
"X-Fern-SDK-Version": "0.1.1",
28+
"X-Fern-SDK-Version": "0.1.2",
2929
**(self.get_custom_headers() or {}),
3030
}
3131
headers["Authorization"] = f"Bearer {self._get_api_key()}"

src/credal/document_collections/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from .types import (
66
CreateCollectionResponse,
77
DeleteCollectionResponse,
8+
ListDocumentsInCollectionResponse,
89
MongoCollectionSyncConfig,
910
MongoCollectionSyncResponse,
1011
MongoSourceFieldsConfig,
@@ -13,6 +14,7 @@
1314
__all__ = [
1415
"CreateCollectionResponse",
1516
"DeleteCollectionResponse",
17+
"ListDocumentsInCollectionResponse",
1618
"MongoCollectionSyncConfig",
1719
"MongoCollectionSyncResponse",
1820
"MongoSourceFieldsConfig",

src/credal/document_collections/client.py

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from .raw_client import AsyncRawDocumentCollectionsClient, RawDocumentCollectionsClient
1111
from .types.create_collection_response import CreateCollectionResponse
1212
from .types.delete_collection_response import DeleteCollectionResponse
13+
from .types.list_documents_in_collection_response import ListDocumentsInCollectionResponse
1314
from .types.mongo_collection_sync_config import MongoCollectionSyncConfig
1415
from .types.mongo_collection_sync_response import MongoCollectionSyncResponse
1516

@@ -144,6 +145,44 @@ def remove_documents_from_collection(
144145
)
145146
return _response.data
146147

148+
def list_documents_in_collection(
149+
self, *, collection_id: uuid.UUID, request_options: typing.Optional[RequestOptions] = None
150+
) -> ListDocumentsInCollectionResponse:
151+
"""
152+
List documents in a collection
153+
154+
Parameters
155+
----------
156+
collection_id : uuid.UUID
157+
The ID of the document collection to list documents from.
158+
159+
request_options : typing.Optional[RequestOptions]
160+
Request-specific configuration.
161+
162+
Returns
163+
-------
164+
ListDocumentsInCollectionResponse
165+
166+
Examples
167+
--------
168+
import uuid
169+
170+
from credal import CredalApi
171+
172+
client = CredalApi(
173+
api_key="YOUR_API_KEY",
174+
)
175+
client.document_collections.list_documents_in_collection(
176+
collection_id=uuid.UUID(
177+
"82e4b12a-6990-45d4-8ebd-85c00e030c24",
178+
),
179+
)
180+
"""
181+
_response = self._raw_client.list_documents_in_collection(
182+
collection_id=collection_id, request_options=request_options
183+
)
184+
return _response.data
185+
147186
def create_collection(
148187
self,
149188
*,
@@ -500,6 +539,51 @@ async def main() -> None:
500539
)
501540
return _response.data
502541

542+
async def list_documents_in_collection(
543+
self, *, collection_id: uuid.UUID, request_options: typing.Optional[RequestOptions] = None
544+
) -> ListDocumentsInCollectionResponse:
545+
"""
546+
List documents in a collection
547+
548+
Parameters
549+
----------
550+
collection_id : uuid.UUID
551+
The ID of the document collection to list documents from.
552+
553+
request_options : typing.Optional[RequestOptions]
554+
Request-specific configuration.
555+
556+
Returns
557+
-------
558+
ListDocumentsInCollectionResponse
559+
560+
Examples
561+
--------
562+
import asyncio
563+
import uuid
564+
565+
from credal import AsyncCredalApi
566+
567+
client = AsyncCredalApi(
568+
api_key="YOUR_API_KEY",
569+
)
570+
571+
572+
async def main() -> None:
573+
await client.document_collections.list_documents_in_collection(
574+
collection_id=uuid.UUID(
575+
"82e4b12a-6990-45d4-8ebd-85c00e030c24",
576+
),
577+
)
578+
579+
580+
asyncio.run(main())
581+
"""
582+
_response = await self._raw_client.list_documents_in_collection(
583+
collection_id=collection_id, request_options=request_options
584+
)
585+
return _response.data
586+
503587
async def create_collection(
504588
self,
505589
*,

src/credal/document_collections/raw_client.py

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from ..core.serialization import convert_and_respect_annotation_metadata
1515
from .types.create_collection_response import CreateCollectionResponse
1616
from .types.delete_collection_response import DeleteCollectionResponse
17+
from .types.list_documents_in_collection_response import ListDocumentsInCollectionResponse
1718
from .types.mongo_collection_sync_config import MongoCollectionSyncConfig
1819
from .types.mongo_collection_sync_response import MongoCollectionSyncResponse
1920

@@ -115,6 +116,47 @@ def remove_documents_from_collection(
115116
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
116117
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
117118

119+
def list_documents_in_collection(
120+
self, *, collection_id: uuid.UUID, request_options: typing.Optional[RequestOptions] = None
121+
) -> HttpResponse[ListDocumentsInCollectionResponse]:
122+
"""
123+
List documents in a collection
124+
125+
Parameters
126+
----------
127+
collection_id : uuid.UUID
128+
The ID of the document collection to list documents from.
129+
130+
request_options : typing.Optional[RequestOptions]
131+
Request-specific configuration.
132+
133+
Returns
134+
-------
135+
HttpResponse[ListDocumentsInCollectionResponse]
136+
"""
137+
_response = self._client_wrapper.httpx_client.request(
138+
"v0/documentCollections/listDocumentsInCollection",
139+
method="GET",
140+
params={
141+
"collectionId": collection_id,
142+
},
143+
request_options=request_options,
144+
)
145+
try:
146+
if 200 <= _response.status_code < 300:
147+
_data = typing.cast(
148+
ListDocumentsInCollectionResponse,
149+
parse_obj_as(
150+
type_=ListDocumentsInCollectionResponse, # type: ignore
151+
object_=_response.json(),
152+
),
153+
)
154+
return HttpResponse(response=_response, data=_data)
155+
_response_json = _response.json()
156+
except JSONDecodeError:
157+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
158+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
159+
118160
def create_collection(
119161
self,
120162
*,
@@ -416,6 +458,47 @@ async def remove_documents_from_collection(
416458
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
417459
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
418460

461+
async def list_documents_in_collection(
462+
self, *, collection_id: uuid.UUID, request_options: typing.Optional[RequestOptions] = None
463+
) -> AsyncHttpResponse[ListDocumentsInCollectionResponse]:
464+
"""
465+
List documents in a collection
466+
467+
Parameters
468+
----------
469+
collection_id : uuid.UUID
470+
The ID of the document collection to list documents from.
471+
472+
request_options : typing.Optional[RequestOptions]
473+
Request-specific configuration.
474+
475+
Returns
476+
-------
477+
AsyncHttpResponse[ListDocumentsInCollectionResponse]
478+
"""
479+
_response = await self._client_wrapper.httpx_client.request(
480+
"v0/documentCollections/listDocumentsInCollection",
481+
method="GET",
482+
params={
483+
"collectionId": collection_id,
484+
},
485+
request_options=request_options,
486+
)
487+
try:
488+
if 200 <= _response.status_code < 300:
489+
_data = typing.cast(
490+
ListDocumentsInCollectionResponse,
491+
parse_obj_as(
492+
type_=ListDocumentsInCollectionResponse, # type: ignore
493+
object_=_response.json(),
494+
),
495+
)
496+
return AsyncHttpResponse(response=_response, data=_data)
497+
_response_json = _response.json()
498+
except JSONDecodeError:
499+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
500+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
501+
419502
async def create_collection(
420503
self,
421504
*,

src/credal/document_collections/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44

55
from .create_collection_response import CreateCollectionResponse
66
from .delete_collection_response import DeleteCollectionResponse
7+
from .list_documents_in_collection_response import ListDocumentsInCollectionResponse
78
from .mongo_collection_sync_config import MongoCollectionSyncConfig
89
from .mongo_collection_sync_response import MongoCollectionSyncResponse
910
from .mongo_source_fields_config import MongoSourceFieldsConfig
1011

1112
__all__ = [
1213
"CreateCollectionResponse",
1314
"DeleteCollectionResponse",
15+
"ListDocumentsInCollectionResponse",
1416
"MongoCollectionSyncConfig",
1517
"MongoCollectionSyncResponse",
1618
"MongoSourceFieldsConfig",
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
5+
import pydantic
6+
import typing_extensions
7+
from ...common.types.resource_identifier import ResourceIdentifier
8+
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
9+
from ...core.serialization import FieldMetadata
10+
11+
12+
class ListDocumentsInCollectionResponse(UniversalBaseModel):
13+
resource_identifiers: typing_extensions.Annotated[
14+
typing.List[ResourceIdentifier], FieldMetadata(alias="resourceIdentifiers")
15+
]
16+
17+
if IS_PYDANTIC_V2:
18+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
19+
else:
20+
21+
class Config:
22+
frozen = True
23+
smart_union = True
24+
extra = pydantic.Extra.allow

0 commit comments

Comments
 (0)