3232 Key as KeyMessage ,
3333 Expression as ExpressionMessage ,
3434 ExpressionValue ,
35- Document as DocumentMessage ,
35+ Document as DocumentMessage , DocumentSetRequest , DocumentGetRequest , DocumentDeleteRequest ,
36+ DocumentQueryStreamRequest , DocumentQueryRequest ,
3637)
3738
3839from nitric .utils import new_default_channel , _dict_from_struct , _struct_from_dict
@@ -74,7 +75,9 @@ def collection(self, name: str) -> CollectionRef:
7475 async def get (self ) -> Document :
7576 """Retrieve the contents of this document, if it exists."""
7677 try :
77- response = await self ._documents ._stub .get (key = _doc_ref_to_wire (self ))
78+ response = await self ._documents ._stub .get (document_get_request = DocumentGetRequest (
79+ key = _doc_ref_to_wire (self )
80+ ))
7881 return _document_from_wire (documents = self ._documents , message = response .document )
7982 except GRPCError as grpc_err :
8083 raise exception_from_grpc_error (grpc_err )
@@ -87,18 +90,20 @@ async def set(self, content: dict):
8790 """
8891 try :
8992 await self ._documents ._stub .set (
90- key = _doc_ref_to_wire (self ),
91- content = _struct_from_dict (content ),
93+ document_set_request = DocumentSetRequest (
94+ key = _doc_ref_to_wire (self ),
95+ content = _struct_from_dict (content ),
96+ )
9297 )
9398 except GRPCError as grpc_err :
9499 raise exception_from_grpc_error (grpc_err )
95100
96101 async def delete (self ):
97102 """Delete this document, if it exists."""
98103 try :
99- await self ._documents ._stub .delete (
104+ await self ._documents ._stub .delete (document_delete_request = DocumentDeleteRequest (
100105 key = _doc_ref_to_wire (self ),
101- )
106+ ))
102107 except GRPCError as grpc_err :
103108 raise exception_from_grpc_error (grpc_err )
104109
@@ -497,9 +502,11 @@ async def stream(self) -> AsyncIterator[Document]:
497502
498503 try :
499504 async for result in self ._documents ._stub .query_stream (
500- collection = _collection_to_wire (self ._collection ),
501- expressions = self ._expressions_to_wire (),
502- limit = self ._limit ,
505+ document_query_stream_request = DocumentQueryStreamRequest (
506+ collection = _collection_to_wire (self ._collection ),
507+ expressions = self ._expressions_to_wire (),
508+ limit = self ._limit ,
509+ )
503510 ):
504511 yield _document_from_wire (documents = self ._documents , message = result .document )
505512 except GRPCError as grpc_err :
@@ -513,10 +520,12 @@ async def fetch(self) -> QueryResultsPage:
513520 """
514521 try :
515522 results = await self ._documents ._stub .query (
516- collection = _collection_to_wire (self ._collection ),
517- expressions = self ._expressions_to_wire (),
518- limit = self ._limit ,
519- paging_token = self ._paging_token ,
523+ document_query_request = DocumentQueryRequest (
524+ collection = _collection_to_wire (self ._collection ),
525+ expressions = self ._expressions_to_wire (),
526+ limit = self ._limit ,
527+ paging_token = self ._paging_token ,
528+ )
520529 )
521530
522531 return QueryResultsPage (
0 commit comments