@@ -190,6 +190,7 @@ async def create_item(
190190 etag : Optional [str ] = None ,
191191 match_condition : Optional [MatchConditions ] = None ,
192192 priority : Optional [Literal ["High" , "Low" ]] = None ,
193+ no_response : Optional [bool ] = None ,
193194 ** kwargs : Any
194195 ) -> Dict [str , Any ]:
195196 """Create an item in the container.
@@ -216,7 +217,10 @@ async def create_item(
216217 request. Once the user has reached their provisioned throughput, low priority requests are throttled
217218 before high priority requests start getting throttled. Feature must first be enabled at the account level.
218219 :raises ~azure.cosmos.exceptions.CosmosHttpResponseError: Item with the given ID already exists.
219- :returns: A dict representing the new item.
220+ :keyword bool no_response: Indicates whether service should be instructed to skip
221+ sending response payloads. When not specified explicitly here, the default value will be determined from
222+ client-level options.
223+ :returns: A dict representing the new item. The dict will be empty if `no_response` is specified.
220224 :rtype: Dict[str, Any]
221225 """
222226 if pre_trigger_include is not None :
@@ -233,6 +237,8 @@ async def create_item(
233237 kwargs ['etag' ] = etag
234238 if match_condition is not None :
235239 kwargs ['match_condition' ] = match_condition
240+ if no_response is not None :
241+ kwargs ['no_response' ] = no_response
236242 request_options = _build_options (kwargs )
237243 request_options ["disableAutomaticIdGeneration" ] = not enable_automatic_id_generation
238244 if indexing_directive is not None :
@@ -243,7 +249,7 @@ async def create_item(
243249 result = await self .client_connection .CreateItem (
244250 database_or_container_link = self .container_link , document = body , options = request_options , ** kwargs
245251 )
246- return result
252+ return result or {}
247253
248254 @distributed_trace_async
249255 async def read_item (
@@ -552,6 +558,7 @@ async def upsert_item(
552558 etag : Optional [str ] = None ,
553559 match_condition : Optional [MatchConditions ] = None ,
554560 priority : Optional [Literal ["High" , "Low" ]] = None ,
561+ no_response : Optional [bool ] = None ,
555562 ** kwargs : Any
556563 ) -> Dict [str , Any ]:
557564 """Insert or update the specified item.
@@ -574,7 +581,11 @@ async def upsert_item(
574581 request. Once the user has reached their provisioned throughput, low priority requests are throttled
575582 before high priority requests start getting throttled. Feature must first be enabled at the account level.
576583 :raises ~azure.cosmos.exceptions.CosmosHttpResponseError: The given item could not be upserted.
577- :returns: A dict representing the upserted item.
584+ :keyword bool no_response: Indicates whether service should be instructed to skip
585+ sending response payloads. When not specified explicitly here, the default value will be determined from
586+ client-level options.
587+ :returns: A dict representing the item after the upsert operation went through. The dict will be empty if
588+ `no_response` is specified.
578589 :rtype: Dict[str, Any]
579590 """
580591 if pre_trigger_include is not None :
@@ -591,6 +602,8 @@ async def upsert_item(
591602 kwargs ['etag' ] = etag
592603 if match_condition is not None :
593604 kwargs ['match_condition' ] = match_condition
605+ if no_response is not None :
606+ kwargs ['no_response' ] = no_response
594607 request_options = _build_options (kwargs )
595608 request_options ["disableAutomaticIdGeneration" ] = True
596609 if self .container_link in self .__get_client_container_caches ():
@@ -602,7 +615,7 @@ async def upsert_item(
602615 options = request_options ,
603616 ** kwargs
604617 )
605- return result
618+ return result or {}
606619
607620 @distributed_trace_async
608621 async def replace_item (
@@ -617,6 +630,7 @@ async def replace_item(
617630 etag : Optional [str ] = None ,
618631 match_condition : Optional [MatchConditions ] = None ,
619632 priority : Optional [Literal ["High" , "Low" ]] = None ,
633+ no_response : Optional [bool ] = None ,
620634 ** kwargs : Any
621635 ) -> Dict [str , Any ]:
622636 """Replaces the specified item if it exists in the container.
@@ -641,7 +655,11 @@ async def replace_item(
641655 before high priority requests start getting throttled. Feature must first be enabled at the account level.
642656 :raises ~azure.cosmos.exceptions.CosmosHttpResponseError: The replace failed or the item with
643657 given id does not exist.
644- :returns: A dict representing the item after replace went through.
658+ :keyword bool no_response: Indicates whether service should be instructed to skip
659+ sending response payloads. When not specified explicitly here, the default value will be determined from
660+ client-level options.
661+ :returns: A dict representing the item after replace went through. The dict will be empty if `no_response`
662+ is specified.
645663 :rtype: Dict[str, Any]
646664 """
647665 item_link = self ._get_document_link (item )
@@ -659,6 +677,8 @@ async def replace_item(
659677 kwargs ['etag' ] = etag
660678 if match_condition is not None :
661679 kwargs ['match_condition' ] = match_condition
680+ if no_response is not None :
681+ kwargs ['no_response' ] = no_response
662682 request_options = _build_options (kwargs )
663683 request_options ["disableAutomaticIdGeneration" ] = True
664684 if self .container_link in self .__get_client_container_caches ():
@@ -667,7 +687,7 @@ async def replace_item(
667687 result = await self .client_connection .ReplaceItem (
668688 document_link = item_link , new_document = body , options = request_options , ** kwargs
669689 )
670- return result
690+ return result or {}
671691
672692 @distributed_trace_async
673693 async def patch_item (
@@ -683,6 +703,7 @@ async def patch_item(
683703 etag : Optional [str ] = None ,
684704 match_condition : Optional [MatchConditions ] = None ,
685705 priority : Optional [Literal ["High" , "Low" ]] = None ,
706+ no_response : Optional [bool ] = None ,
686707 ** kwargs : Any
687708 ) -> Dict [str , Any ]:
688709 """ Patches the specified item with the provided operations if it
@@ -707,7 +728,11 @@ async def patch_item(
707728 :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
708729 request. Once the user has reached their provisioned throughput, low priority requests are throttled
709730 before high priority requests start getting throttled. Feature must first be enabled at the account level.
710- :returns: A dict representing the item after the patch operations went through.
731+ :keyword bool no_response: Indicates whether service should be instructed to skip
732+ sending response payloads. When not specified explicitly here, the default value will be determined from
733+ client-level options.
734+ :returns: A dict representing the item after the patch operation went through. The dict will be empty if
735+ `no_response` is specified.
711736 :raises ~azure.cosmos.exceptions.CosmosHttpResponseError: The patch operations failed or the item with
712737 given id does not exist.
713738 :rtype: dict[str, Any]
@@ -724,6 +749,8 @@ async def patch_item(
724749 kwargs ['etag' ] = etag
725750 if match_condition is not None :
726751 kwargs ['match_condition' ] = match_condition
752+ if no_response is not None :
753+ kwargs ['no_response' ] = no_response
727754 request_options = _build_options (kwargs )
728755 request_options ["disableAutomaticIdGeneration" ] = True
729756 request_options ["partitionKey" ] = await self ._set_partition_key (partition_key )
@@ -733,8 +760,9 @@ async def patch_item(
733760 request_options ["containerRID" ] = self .__get_client_container_caches ()[self .container_link ]["_rid" ]
734761
735762 item_link = self ._get_document_link (item )
736- return await self .client_connection .PatchItem (
763+ result = await self .client_connection .PatchItem (
737764 document_link = item_link , operations = patch_operations , options = request_options , ** kwargs )
765+ return result or {}
738766
739767 @distributed_trace_async
740768 async def delete_item (
0 commit comments