Skip to content

Commit 006a738

Browse files
Merge pull request #80 from tjmlabs/main-default-collection
default collection -> default_collection
2 parents b4cf4e0 + 779498f commit 006a738

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ client = ColiVara(
3030
base_url="https://api.colivara.com"
3131
)
3232

33-
# Upload a document to the default collection
33+
# Upload a document to the default_collection
3434
document = client.upsert_document(
3535
name="sample_document",
3636
url="https://example.com/sample.pdf",

web/api/tests/tests.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ async def test_create_document_pdf_url_await(async_client, user):
324324
"metadata": {},
325325
"url": "https://pdfobject.com/pdf/sample.pdf",
326326
"num_pages": 1,
327-
"collection_name": "default collection",
327+
"collection_name": "default_collection",
328328
"pages": None,
329329
}
330330

@@ -481,7 +481,7 @@ async def test_create_document_pdf_base64_await(async_client, user, collection):
481481
assert response_data["name"] == "Test Document Fixture"
482482
assert response_data["metadata"] == {}
483483
assert response_data["num_pages"] == 1
484-
assert response_data["collection_name"] == "default collection"
484+
assert response_data["collection_name"] == "default_collection"
485485
assert response_data["pages"] is None
486486
await Document.objects.all().adelete()
487487

@@ -688,7 +688,7 @@ async def test_get_document_by_name(async_client, user, collection, document):
688688
async def test_get_document_by_name_multiple_documents(
689689
async_client, user, collection, document
690690
):
691-
# first we create a new document with the same name under default collection
691+
# first we create a new document with the same name under default_collection
692692
response = await async_client.post(
693693
"/documents/upsert-document/",
694694
json={
@@ -784,7 +784,7 @@ async def test_patch_document_not_found(async_client, user, collection, document
784784
async def test_patch_document_multiple_documents(
785785
async_client, user, collection, document
786786
):
787-
# first we create a new document with the same name under default collection
787+
# first we create a new document with the same name under default_collection
788788
response = await async_client.post(
789789
"/documents/upsert-document/",
790790
json={
@@ -912,7 +912,7 @@ async def test_delete_document_not_found(async_client, user, collection, documen
912912
async def test_delete_document_multiple_documents(
913913
async_client, user, collection, document
914914
):
915-
# first we create a new document with the same name under default collection
915+
# first we create a new document with the same name under default_collection
916916
response = await async_client.post(
917917
"/documents/upsert-document/",
918918
json={

web/api/views.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,8 @@ class DocumentIn(Schema):
313313
name: str
314314
metadata: dict = Field(default_factory=dict)
315315
collection_name: str = Field(
316-
"default collection",
317-
description="""The name of the collection to which the document belongs. If not provided, the document will be added to the default collection. Use 'all' to access all collections belonging to the user.""",
316+
"default_collection",
317+
description="""The name of the collection to which the document belongs. If not provided, the document will be added to the default_collection. Use 'all' to access all collections belonging to the user.""",
318318
)
319319
url: Optional[str] = None
320320
base64: Optional[str] = None
@@ -349,8 +349,8 @@ class DocumentInPatch(Schema):
349349
name: Optional[str] = None
350350
metadata: Optional[dict] = Field(default_factory=dict)
351351
collection_name: Optional[str] = Field(
352-
"default collection",
353-
description="""The name of the collection to which the document belongs. If not provided, the document will be added to the default collection. Use 'all' to access all collections belonging to the user.""",
352+
"default_collection",
353+
description="""The name of the collection to which the document belongs. If not provided, the document will be added to the default_collection. Use 'all' to access all collections belonging to the user.""",
354354
)
355355
url: Optional[str] = None
356356
base64: Optional[str] = None
@@ -453,7 +453,7 @@ async def upsert_document(
453453
454454
This endpoint allows the user to create or update a document in a collection.
455455
The document can be provided as a URL or a base64-encoded string.
456-
if the collection is not provided, a collection named "default collection" will be used.
456+
if the collection is not provided, a collection named "default_collection" will be used.
457457
if the collection is provided, it will be created if it does not exist.
458458
459459
Args:
@@ -476,7 +476,7 @@ async def upsert_document(
476476
"wait": true # optional, if true, the response will be sent after waiting for the document to be processed. Otherwise, it will be done asynchronously.
477477
}
478478
"""
479-
# if the user didn't give a collection, payload.collection will be "default collection"
479+
# if the user didn't give a collection, payload.collection will be "default_collection"
480480
if payload.collection_name == "all":
481481
return 400, GenericError(
482482
detail="The collection name 'all' is not allowed when inserting or updating a document - only when retrieving. Please provide a valid collection name."
@@ -501,12 +501,12 @@ async def upsert_document(
501501
async def get_document(
502502
request: Request,
503503
document_name: str,
504-
collection_name: Optional[str] = "default collection",
504+
collection_name: Optional[str] = "default_collection",
505505
expand: Optional[str] = None,
506506
) -> Tuple[int, DocumentOut] | Tuple[int, GenericError]:
507507
"""
508508
Retrieve a specific document from the user documents.
509-
Default collection is "default collection".
509+
Default collection is "default_collection".
510510
To get all documents, use collection_name="all".
511511
512512
Args:
@@ -577,7 +577,7 @@ async def get_document(
577577
)
578578
async def list_documents(
579579
request: Request,
580-
collection_name: Optional[str] = "default collection",
580+
collection_name: Optional[str] = "default_collection",
581581
expand: Optional[str] = None,
582582
) -> List[DocumentOut]:
583583
"""
@@ -588,7 +588,7 @@ async def list_documents(
588588
589589
Args:
590590
request (Request): The request object.
591-
collection_name (Optional[str]): The name of the collection to fetch documents from. Defaults to "default collection". Use "all" to fetch documents from all collections.
591+
collection_name (Optional[str]): The name of the collection to fetch documents from. Defaults to "default_collection". Use "all" to fetch documents from all collections.
592592
expand (Optional[str]): A comma-separated string specifying additional fields to include in the response.
593593
If "pages" is included, the pages of each document will be included.
594594
@@ -599,7 +599,7 @@ async def list_documents(
599599
HTTPException: If the collection or documents are not found.
600600
601601
Example:
602-
GET /documents/?collection_name=default collection&expand=pages
602+
GET /documents/?collection_name=default_collection&expand=pages
603603
"""
604604
expand_fields = expand.split(",") if expand else []
605605

@@ -737,7 +737,7 @@ async def partial_update_document(
737737
async def delete_document(
738738
request: Request,
739739
document_name: str,
740-
collection_name: Optional[str] = "default collection",
740+
collection_name: Optional[str] = "default_collection",
741741
) -> Tuple[int, None] | Tuple[int, GenericError]:
742742
"""
743743
Delete a document by its Name.
@@ -747,7 +747,7 @@ async def delete_document(
747747
748748
Args:
749749
request: The HTTP request object, which includes authentication information.
750-
collection_name (name): The name of the collection containing the document. Defaults to "default collection". Use "all" to access all collections belonging to the user.
750+
collection_name (name): The name of the collection containing the document. Defaults to "default_collection". Use "all" to access all collections belonging to the user.
751751
document_name (int): The name of the document to be deleted.
752752
753753
Returns:

0 commit comments

Comments
 (0)