55from nisystemlink .clients import core
66from nisystemlink .clients .core ._uplink ._base_client import BaseClient
77from nisystemlink .clients .core ._uplink ._methods import delete , get , post
8- from nisystemlink .clients .result .models import Result
8+ from nisystemlink .clients .result .models import (
9+ Result ,
10+ UpdateResultRequest ,
11+ )
912from uplink import Field , Query , retry , returns
1013
1114from . import models
@@ -125,8 +128,8 @@ def query_result_values(self, query: models.QueryResultValuesRequest) -> List[st
125128 ...
126129
127130 @post ("update-results" , args = [Field ("results" ), Field ("replace" )])
128- def update_results (
129- self , results : List [Result ], replace : bool = False
131+ def __update_results (
132+ self , results : List [UpdateResultRequest ], replace : bool = False
130133 ) -> models .ResultsPartialSuccess :
131134 """Updates a list of results with optional field replacement.
132135
@@ -147,6 +150,37 @@ def update_results(
147150 """
148151 ...
149152
153+ def update_results (
154+ self ,
155+ results : List [UpdateResultRequest ],
156+ replace : bool = False ,
157+ allow_workspace_update : bool = False ,
158+ ) -> models .ResultsPartialSuccess :
159+ """Updates a list of results with optional field replacement.
160+
161+ Args:
162+ `results`: A list of results to update. Results are matched for update by id.
163+ `replace`: Replace the existing fields instead of merging them. Defaults to `False`.
164+ If this is `True`, then `keywords` and `properties` for the result will be
165+ replaced by what is in the `results` provided in this request.
166+ If this is `False`, then the `keywords` and `properties` in this request will
167+ merge with what is already present in the server resource.
168+ `allow_workspace_update`: If this is set to `False`, the `workspace` field will be set to None
169+ before updating.
170+
171+ Returns: A list of updates results, results that failed to update, and errors for
172+ failures.
173+
174+ Raises:
175+ ApiException: if unable to communicate with the ``/nitestmonitor`` Service
176+ or provided an invalid argument.
177+ """
178+ if not allow_workspace_update :
179+ for result in results :
180+ result .workspace = None
181+
182+ return self .__update_results (results , replace )
183+
150184 @delete ("results/{id}" )
151185 def delete_result (self , id : str ) -> None :
152186 """Deletes a single result by id.
0 commit comments